Jenkins

Jenkins is a continuous integration server which creates the build and deploys on the environment. It can also be used as a scheduler where you can schedule your test and build process in a nightly fashion.

Jenkins can also help you achieve code quality by integrating with tools like selenium and SoapUI. Based on the results of the test runs, action could be taken to improve the current build.

Installing Jenkins on Windows

As we know what Jenkins is, let's see how it can be integrated with testing tools. But before that let's see how to setup Jenkins.

Setting up Jenkins on your local machine:

  1. Download the .war file from: https://updates.jenkins-ci.org/download/war/
    Installing Jenkins on Windows
  2. Once the .war files are downloaded, open a command prompt and enter the following command:
    Java –jar  "Path of WAR file" 
    
  3. After typing the command press Enter.
    Installing Jenkins on Windows
  4. Verify that the execution begins on the command line:
    Installing Jenkins on Windows
  5. Once the execution has begun, it's now time to invoke Jenkins by opening the browser and entering the URL http://localhost:8080/.
  6. Verify that the following screen pops up:
    Installing Jenkins on Windows

The preceding screen proves that we have successfully installed Jenkins on a Windows machine.

Integrating Jenkins with SoapUI

Now as we have installed Jenkins on the machine let's see how we integrate SoapUI with it:

  1. Click on New Item and select a free style project as shown in the following screenshot:
    Integrating Jenkins with SoapUI
  2. After selecting the project type, click OK:
    Integrating Jenkins with SoapUI
  3. After which you will be navigated to the following screen:
    Integrating Jenkins with SoapUI

    In the preceding screen you can add the description of the project.

  4. Configure the source code repositories by using the Advanced Project options:
    Integrating Jenkins with SoapUI

    After we have added the source code repository details, your repository is in sync with your tool.

    You also have certain other build options which can be useful in configuring your build:

    Integrating Jenkins with SoapUI

    After you have configured your build options, you have now learnt how to integrate your codebase with Jenkins. Now is the time for integrating the test tools.

Integrating the test tools

If you see in the following screenshot, we have several options to add a build step:

Integrating the test tools

Using Ant: We have in previous chapters seen how can we create a build.xml file to execute and generate reports for our Test automation suites. We can use the same build.xml file and the same shall work for us.

<arg line= "-j -f  'c:projectSoapUITest ' ' like c:/project/SoapUITest  like c:/project/SoapUITest /Production.xml'"/> 
  </exec>
  </target>
  <target name = "testreport" depends ="soapui"> 
     <junitreport todir="C:/Users/pnandan/Desktop/Analysis/NewFolder"> 
       <fileset dir="C:/Users/pnandan/Desktop/Analysis/NewFolder"> 
         <include name="TEST-TestSuite_1.xml"/> 
       </fileset> 
       <report todir="C:/Users/Admin / Analysis/Reports /HTML"
          styledir="C:/Testing/apache-ant-1.9.6/etc"
          format="frames">  
       </report>
     </junitreport>
  </target>
</project>

The second option we have is to invoke a batch file. We can use the command line functionality of SoapUI to create a batch file which executes the project:

Commandline utility of soap UI
Sample Batch file:

cd C:Program FilesSmartBearsoapUI-4.0.1in testrunner.bat -ehttps://192.90.190.19:7001/test?wsdl -sTestSuite -r -a -fC:UserspnandanDesktopatchsoap -I "C:UserspnandanDesktopatsoapsoapuitestproject.xml"

Use the batch file and enter the details of the configuration of your project and name it with an extension .bat.

Once you have done that you can pass the reference in the Execute Windows batch command option displayed in the preceding screenshot.

Now to integrate it using the same batch file, you just need to add the batch file content to the execute Windows batch file command, as shown in the following screenshot.

The following screenshot shows how you can add the batch file and run SoapUI from Jenkins:

Integrating the test tools

Let's also have a look at the command line options available:

  • a: Returns all test results, not only errors
  • A: Returns results using folders instead of long names
  • c: This can be used to select the specified test cases to be run
  • D: Sets system property with name=value
  • d: The domain to use in any authentications, overrides any domain set for any TestRequests
  • e: Sets the endpoint to be used
  • f: Specifies the root folder to which test results should be exported
  • G: Sets global property with name=value
  • h: The host:port to use when invoking test-requests, overrides only the host part of the endpoint set in the project file
  • I: Do not stop if error occurs, ignore them
  • i: Enables SoapUI UI-related components
  • j: Turns on exporting of JUnit-compatible reports
  • M: Creates a Test Run Report in XML format
  • m: Sets the threshold value for test step errors
  • P: Sets project property with name value pair
  • p: The password to use in any authentication
  • r: Turns on printing of a small summary report
  • S: Sets to save the project file after tests have been run
  • s: Used to select the test suite to run
  • t: Sets the soapui-settings.xml file
  • u: The username to use in any authentication
  • v: Sets password for soapui-settings.xml file
  • w: Sets the WSS password type
  • x: Sets project password

So now we have seen two possible ways to integrate SoapUI or any other tool with Jenkins using Ant and a batch file.

Once we are done with integrating the tool now is the time to see what can be done post-test case execution.

Post execution steps

Once you have done the execution step you may want to decide to perform additional steps. For that you have options in Add post-build action.

Post execution steps

Let's have a look at some of the options that can be useful to us:

  • Build other projects: This option can be used to run another ant task which could be to revert the build in case most of the test cases have failed
  • Publish JUnit style report: This option is used to build a JUnit style report
  • E-mail Notification: Publish an e-mail to the stakeholders with the results of the test run with build deployed or reverted status

This gives us a view of end to end use of Jenkins with respect to integration with SoapUI.

Integrating with test management tools

With the Test Automation phase of Software Testing Life Cycle showing tremendous increase in the ROI, project leaders want to get more and more out of it, which has laid the foundations of more areas which can be covered as part of test automation.

Tracking the results of the Test automation runs has always been a tedious job, it is very important to keep track of such metrics since they can be used to track the build cycle automation suite performance, defect metrics, and so on.

So to avoid manual effort of updating the test results in Test management tools, testers have come up with innovative solutions to automate the process of updating the test management tools with the test automation results status.

Integrating with test management tools

Updating of Test results can be triggered from the Automation suite as well as from the Test management tool as shown in the figure preceding.

So, in the Test Management Tool, when you run any test case it runs the Test Automation suite and updates QC automatically. Or, if you run the Test Automation suite it updates the test case status in QC automatically.

So let's see how we do that.

Let take a look at the top two test management tools on the market:

  • JIRA with Zephyr: For JIRA integration we have a JIRA Plugin available which only works with the Pro edition of SoapUI which is Ready API
  • HP QC: SoapUI open source can still be integrated with QC

QC Integration with SoapUI

Dragonfly is the answer to the question; how do we integrate QC with SoapUI? so let's see how we update QC with Automation test cases results automatically and vice versa.

  1. Download Dragonfly from the following link:

    http://www.agiletestware.com/dragonfly

    While installing Dragonfly, please provide the directory to be installed as the bin directory of SoapUI.

    QC Integration with SoapUI
  2. Now you need to create the following custom properties at project level in SoapUI:
    • QC_URL
    • QC_Domain
    • QC_Project
    • QC_User
    • QC_Password
    • QC_TestPlanDirectory
    • QC_TestLabDirectory
    • QC_soapUI_ARGS
    • QC_Bulk Update
    • QC_Run Name
    • QC_ProjectPath
    • QC_Export_Disabled_Tests
    • QC_Dragonfly_Plugin
  3. In case you want to create test cases from QC to SoapUI or you want to create tests from SoapUI to QC you can use the following two options

    Before that, create a project in SoapUI and right click on the project level in SoapUI and you can verify that the options for the Dragonfly plugins are now available.

    • Dragonfly: Export to HP ALM: This feature is to create test cases in QC which already reside in SoapUI
    • Dragonfly: Import to HP ALM: This feature allows you to import tests from QC and create tests in SoapUI

    Now if you select any of the features, for example Export to HP ALM you will see the following screen:

    QC Integration with SoapUI

    Which will make sure that the test is now created in HP QC.

  4. Now once you have exported your test, you can now run your test normally and on completion the test case results will be updated in HP QC:
    QC Integration with SoapUI

With this we have come to the end of this chapter. Let's see the summary section to see what have we covered in this chapter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.187.108