Applies to ReadyAPI 2.5, last modified on October 22, 2018

This topic describes a general approach to running ReadyAPI tests from Jenkins.

Overview

We need to create a Jenkins job that will run ReadyAPI tests from Jenkins slave machines (or Jenkins nodes). To run ReadyAPI tests, you need to install ReadyAPI on each Jenkins node and use the SoapUI Pro Functional Testing plugin or ReadyAPI command-line runners to run the tests.

The SoapUI Pro Functional Testing plugin provides you with an easy way to run functional tests from Jenkins. If you need to run load or secure tests, or if you need to specify advanced options for a functional test run, use the command-line runners.

Note: To deploy, start, stop or update virtual services on VirtServer, use the Jenkins VirtServer plugin.

Required license

In order to run ReadyAPI tests, you need to activate the appropriate license on each node. The easiest way to do this is to install ReadyAPI on a node and activate the license through the ReadyAPI user interface. However, it is considered to be a good practice to clean up the test environment after the test run is over. In other words, you may want to configure nodes automatically before each run, and this means you may want to automate the ReadyAPI license activation. ReadyAPI supports a special command-line tool to automate activation (see below).

Which license to use: Floating or Fixed? It is reasonable to select a Floating license as it suites dynamic testing environments in a better way. You will activate the license on some computer in your network (let’s call it license server) and configure ReadyAPI instances on Jenkins nodes to connect to this server and to check out the license from it.

Requirements to Jenkins nodes

  • One of the supported Java versions installed.

  • Network access to the license server with the Floating license activated (by default, the server works on port 1099).

  • Access to the ReadyAPI License Manager .jar file. You can download it in the .zip format from our website. Extract the .jar file from the downloaded .zip archive and copy it to your Jenkins node or put to a shared network folder, to which the node has access.

  • Access to the ReadyAPI installation program (you can copy it to your Jenkins nodes, or you can put it to a shared network folder).

  • On Windows Jenkins nodes, disable the User Account Control (UAC). You can do this in the Control Panel. Otherwise, Windows can display various system confirmation dialogs, which require user interaction.

SoapUI Pro Functional Testing plugin

To make the communication between Jenkins and SoapUI easier, consider installing the Jenkins SoapUI Pro Functional Testing plugin. To install it:

  1. Open Jenkins and click Manage Jenkins:

  2. Open Manage Plugins:

    Automating ReadyAPI: Managing Jenkins plugins

    Click the image to enlarge it.

  3. On the Available page, type SoapUI in the Filter field and select SoapUI Pro Functional Testing Plugin.

    Automating ReadyAPI: Select SoapUI Pro Functional Testing Plugin

    Click the image to enlarge it.

  4. Click Install without restart or Download now and install after restart:

    Install SoapUI Pro Functional Testing Plugin

    Click the image to enlarge it.

1. Create and configure Jenkins nodes

Jenkins documentation includes a detailed guide on configuring Jenkins nodes. Follow the instructions on this page:

https://wiki.jenkins.io/display/JENKINS/Step+by+step+guide+to+set+up+master+and+slave+machines+on+Windows

Tip: We recommend using Java Web Start for launching nodes in most scenarios. The optimal method depends on your environment.

2. Install ReadyAPI on Jenkins nodes

To install ReadyAPI automatically:

  1. Use the Execute batch command build step. The way you add it depends on the operating system of the Jenkins node:

    • Windows Jenkins nodes: select Add build step > Execute Windows batch command.

    • Linux or Mac nodes: select Add build step > Execute shell.

    Execute batch command build step

    Click the image to enlarge it.

  2. Configure the step to run the ReadyAPI installer. Add the -q argument to the installer command line. This way, the installation will run in silent mode, that is, without any user interaction, and will use the default values for all options.

    To change the installation folder, you can use the -dir argument. -varfile lets you specify additional installation parameters. You can find more information in the install4j documentation.

    Here is a sample command line that installs ReadyAPI in silent mode:

    "c:\sample\ReadyAPI-x64-2.5.0.exe" -q -dir "c:\readyapi-folder" -varfile response.varfile

3. Get ReadyAPI license

  1. On your Jenkins node, create a text file that will contain the code of the ReadyAPI application, whose license you want to consume:

    1 SoapUI
    2 LoadUI
    3 Secure
    4 ServiceV
    5 VirtServer
    Tip: If you use the SoapUI Functional Testing plugin, specify 1.
  2. To get the ReadyAPI license, run the License Manager .jar file (ready-api-license-manager-1.2.5.jar) from the command line. To do this, add another Execute batch command step to your Jenkins job. Use the -s license-server-IP:port < file argument to specify the license server from which the .jar file will consume a Floating license:

    java -jar c:\path\ready-api-license-manager-1.2.5.jar -s 10.0.81.128:1099 < c:\readyapi-folder\MyCode.txt

    Here, MyCode.txt is the file that contains the code of the licensed ReadyAPI application (see above).

4. Copy test projects and data files to nodes

To run ReadyAPI tests from a Jenkins node, you need to copy your ReadyAPI project to this node. You also need to copy the data files your tests use.

To copy the files, use the Jenkins Copy file build step. A possible alternative is to place the project and data file to some shared network folder to which Jenkins nodes have access.

5. Run tests

By using the SoapUI Pro Functional Testing plugin

To run SoapUI tests in Jenkins:

  • Make sure the SoapUI Functional Testing plugin is installed.

  • In Jenkins, select a job and click Configure.

  • In the Build section, click Add build step > SoapUI Pro: Run functional Test:

  • Jenkins will add the step to the build:

    Automating ReadyAPI: Run functional tests from Jenkins

    Click the image to enlarge it.

  • Configure the following build step options:

    Option Description
    Path to TestRunner Specifies the fully-qualified path to the test runner binary (testrunner.bat or testrunner.sh). By default, you can find it in the <ReadyAPI installation>/bin directory.
    Path to SoapUI Pro project Specifies the fully-qualified path to the SoapUI project you want to run.
    Test Suite Specifies the test suite to run. To run all the test suites of your project, leave the field blank.
    Test Case Specifies the test case to run. If you leave the field blank, the runner will execute all the test cases of the specified test suite, or, if you have not specified a test suite, all the test cases of your project.
    Project Password Specifies the encryption password, if you encrypted the entire project or some of its custom properties. See Protecting Sensitive Data.
    Environment Specifies the environment configuration for the test run.
    It is impossible to specify additional arguments for the test runner the plugin activates. If you want to do that, call the test runner using the command line – see above.
Analyze results

If you use the SoapUI Pro Functional Testing plugin, the SoapUI test runner exports a JUnit-style HTML report to your Jenkins workspace directory.

You can also view a PDF version of the report directly from Jenkins. To do that, open the needed project and build, then click the SoapUI Pro Test Results link to the left:

The SoapUI Pro Test Results link

Click the image to enlarge it.

To run tests, use one of the ReadyAPI command-line test runners:

To run any of these tools, add an Execute batch command step to your Jenkins job. As we wrote above, the way you do this depends on the operating system of your Jenkins node.

Below is a sample command line that starts a functional SoapUI test on a Windows Jenkins node:

"c:\readyapi-folder\bin\testrunner.bat" "-sTest Suite 1" -cSimpleRequest "-RTestCase Report" "-EDefault environment" "c:\work\projects\my-project.xml"

For complete information on the command-line arguments, follow the links above.

Possible issues

By default, Jenkins runs jobs by using its own user profile. In this case, if you use a Fixed license, ReadyAPI will not be able to find it. To learn how to fix this issue, see Jenkins: "License Not Found" Issue.

See Also

Integrations

Highlight search results