We have 2 different applications and we need to perform end to end testing. One application support automation through selenium. Other support automation through UFT. I am trying to launch UFT using Java and run the UFT script first. Once UFT part is completed I will work with other applications using selenium. I am successfully able to launch UFT process but unable to execute the script.
As of now, I am successfully able to launch UFT through java code.
public static void main(String args[]) {
try {
PrintStream out = new PrintStream(new FileOutputStream("LaunchQTP.vbs"));
out.println("Set qtApp = CreateObject(\"QuickTest.Application\")");
out.println("qtApp.Launch");
out.println("qtApp.Visible = True");
out.close();
Process p = Runtime.getRuntime().exec("cscript LaunchQTP.vbs");
p.waitFor();
out.println(p.exitValue());
} catch (Exception err) {
err.printStackTrace();
}
}
Note: Challenge is how to run the scripts present in UFT after UFT is launched.