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
- Go to the Jenkins Server home page.
- Click the New Job link or select an existing job.
- Enter a Job name (for a new job).
- Select Build a free-style software project and click OK.
- In the Project Configuration section scroll down to the Build section.
- Expand the Add build step drop-down and select Execute HP tests from file system.
- 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>
- Optionally, indicate a timeout in seconds after which the job will fail in the Timeout box.
- 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
- In the Post-build Actions section, expand the Add post-build action drop-down and select Publish HP test result.
- 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 or schedule the job as you would with any standard Jenkins job.
Review the results
- From the dashboard, click on the job.
- Click the Build Artifacts link to view the results zip files.
- 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:
- Open the Run Results Viewer and select File > Open.
- In the Open dialog box, select Results XML file and navigate to the Results.xml file in the folder that you extracted.
- Click Open and view the results.
Nice one article and very helpful
ReplyDelete