Saturday 7 November 2015

HP UFT/QTP integration with Jenkins



Installing Jenkins

First, you need to start Jenkins before installing it. This can be done from JNLP, or by running "java -jar jenkins.war".

Now connect to Jenkins by going to the following URL http://<hostname>:8080/

Integrating Jenkins with QTP/UFT

We can integrate QTP/UFT with Jenkins starting version from QTP 11.0 to later versions




Once you are done with installation we can see HP Application Automation tools available in “Installed” tab.

Running QTP/UFT script from Jenkins

 Set up a job
  1. Go to the Jenkins Server home page.
  2. Click the New Job link or select an existing job.
  3. Enter a Job name (for a new job).
  4. Select Build a free-style software project and click OK.
  1. In the Project Configuration section scroll down to the Build section.
  1. Expand the Add build step drop-down and select Execute HP tests from file system.

  1. In the Tests box, enter a test with its full absolute path, or a folder or MTB containing one or more tests or LoadRunner scenarios. To specify multiple entries, click the down arrow on the right of the field and enter each test path on a separate line. Make sure that the paths are accessible from all machines in the local network. 

    For functional tests (UFT), you can also indicate a batch file that contains a list of tests, along with their parameters. You can specify multiple tests, or the same test several times with different parameters. Note that you can use Jenkins environment variables in the path names. The batch file should have an .mtbx extension and follow this sample syntax.
<Mtbx>
 
   <Test name="test1" path="c:\tests\APITest1">
   <Parameter name="A" value="abc" type="string"/>
        ….
       </Test>
       <Test name="test2" path="${WORKSPACE}\test2">   
       <Parameter name="p1" value="123" type="int"/>
       <Parameter name="p4" value="123.4" type="float"/>
       ….
       </Test>
</Mtbx>
 
  1. Optionally, indicate a timeout in seconds after which the job will fail in the Timeout box. 
  2. Click Apply to save your changes and continue with more build steps. Click Save when you are finished adding build steps.



 Set up the Post Build Actions


  1. In the Post-build Actions section, expand the Add post-build action drop-down and select Publish HP test result.
  2. Select an archiving option for the test run results:
     * Archive test run results for failed tests - save test results for failed tests only
     * Always archive test run results  - always save test result reports
     * Do not archive test run results - never save the test results
Run the job
  1. Run or schedule the job as you would with any standard Jenkins job.

Review the results


  1. From the dashboard, click on the job.
  2. Click the Build Artifacts link to view the results zip files.
  3. Extract the zip file.

In functional tests, the extracted zip file contains the result files, viewable in the Run Results Viewer. To view the results:
  1. Open the Run Results Viewer and select File > Open.
  2. In the Open dialog box, select Results XML file and navigate to the Results.xml file in the folder that you extracted.
  3. Click Open and view the results.

1 comment: