1

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.

Sers
  • 12,047
  • 2
  • 12
  • 31
ARanjan
  • 21
  • 3

1 Answers1

1

I did the same thing using Jenkins. We created two jobs one for the UFT script and the other for Selenium. Now we made the jobs inter-dependent and it works like a charm.

Satish
  • 11
  • 3
  • I used a VBS file with below code VB script codeDim QTPObj,QTPTest Set QTPObj=CreateObject("QuickTest.Application") 'Check if the application is not already Launched If Not QTPObj.Launched then QTPObj.Launch End If QTPObj.Visible=True QTPObj.Open "Z:\Users\aranjan2\Documents\OASIS_AUTOMATION\Scripts\MasterFile", True 'name of the start up script Set QTPTest=QTPObj.Test QTPTest.RunAction "Script_02_UpdateCustomer" QTPTest.Close 'Close the Test QTPObj.Quit 'Quit the QTP Application – ARanjan Oct 18 '19 at 05:15
  • Ran this VBS file using java – ARanjan Oct 18 '19 at 05:17