Running Ranorex Webtestit in Jenkins for Continuous Integration


#1

The following describes the necessary steps to create a build process with Jenkins.

Make sure you open a new command prompt/terminal after installing the dependencies used by Webtestit and restart the agent so the new environment variables get recognised.
Also, if you have Ranorex Webtestit application opened before starting the build, make sure that you close it, otherwise you will get the “Cannot run multiple instances” error.

Windows

  1. You need to run the Jenkins service as a user account. Follow the instructions on the official documentation.
    Alternatively, you can use a Jenkins slave in interactive mode.
    For more information check the official documentation.

  2. Install Ranorex Webtestit with the user you start the Jenkins service with

  3. Make sure you follow the instructions to setup the java jdk on the Jenkins server/slave

  4. Make sure to install all browsers you want to test on the Jenkins server/slave

  5. Restart the agent using a NEW command prompt window

  6. Create a new Jenkins job that suits your needs.

  7. If you like to publish your test results make sure you install the JUnit-Plugin

  8. In your job add a Execute Windows batch command build step

  9. Add the following command: "%LOCALAPPDATA%\Programs\webtestit\Ranorex Webtestit.exe" run --report-file-destination="%WORKSPACE%\testresults" --endpoints-config="/Users/mgrundner/Desktop\endpoints.json" "%WORKSPACE%\path\to\your\project"

  10. Under Advanced Project Options, check use custom workspace checkbox. Enter the location of your project in the Directory field.

  11. Add a Publish JUnit test result report Post-build Action

  12. Set the Test report XMLs include set to testresults\*.xml

  13. Now you can run your build and see the result
    2018-05-17%2010_37_53-Microsoft%20Edge

MacOS

  1. You need to run the Jenkins agent as Launch agent. See the official documentation

  2. Install Ranorex Webtestit with the user you start the Jenkins agent with.

  3. Make sure you follow the instructions to setup the java jdk on the Jenkins server/slave

  4. Make sure to install all browsers you want to test on the Jenkins server/slave

  5. Restart the agent using a NEW terminal window

  6. Create a new Jenkins job that suits your needs.

  7. If you like to publish your test results make sure you install the JUnit-Plugin

  8. In your job add a Execute shell build step

  9. Add the following command: /Applications/Ranorex\ Webtestit.app/Contents/MacOS/Ranorex\ Webtestit run --report-file-destination=/users/yourUsername/yourProjectPath/reports --endpoints-config=/Users/yourUsername/locationOfEndpointFile Users/YourUsername/yourProjectPath

  10. Under Advanced Project Options, check use custom workspace checkbox. Enter the location of your project in the Directory field.

  11. Add a Publish JUnit test result report Post-build Action

  12. Set the Test report XMLs include set to testresults/*.xml

  13. Now you can run your build and see the result
    2018-05-17%2010_37_53-Microsoft%20Edge

Linux

  1. You need to run the Jenkins agent as Launch agent. Follow the instructions on this excellent blog post.
    Alternatively, you can use a Jenkins slave.
    For more information check the official documentation.

  2. Install Ranorex Webtestit with the user you start the Jenkins agent with.

  3. Make sure you follow the instructihttps://discourse.webtestit.com/uploads/default/original/2X/5/5587c22442132de4ea9cea5087aaee3683d907ce.mp4 ons to setup the java jdk on the Jenkins server/slave

  4. Make sure to install all browsers you want to test on the Jenkins server/slave

  5. Restart the agent using a NEW terminal window

  6. Create a new Jenkins job that suits your needs.

  7. If you like to publish your test results make sure you install the JUnit-Plugin

  8. In your job add a Execute shell build step

  9. Add the following command: "/opt/Ranorex Webtestit/webtestit"" run --report-file-destination="${WORKSPACE$}/testresults" --endpoints-config="$C:\Users\mgrundner\Desktop\endpoints.json" "${WORKSPACE$}/path/to/your/project"

  10. Under Advanced Project Options, check use custom workspace checkbox. Enter the location of your project in the Directory field.

  11. Add a Publish JUnit test result report Post-build Action

  12. Set the Test report XMLs include set to testresults/*.xml

  13. Now you can run your build and see the result
    2018-05-17%2010_37_53-Microsoft%20Edge

Check out this short video sample on how to set up Jenkins to run a demo project with Ranorex Webtestit

Further topics: Command Line Interface (CLI)


Creating Jenkins Job with Webtestit-- Do we have to specify the location of the json file?
Jenkins Integration: End point configuration path is not available for Windows configuration
Jenkins Integration: Online docummentation
Runnung a test without webtestit installed
Dockerizing Ranorex Webtestit
Runnung a test without webtestit installed
WebTestIt integration with existing remote Jenkins server/slave
Report tab always opens in dark theme
Jenkins integration : Junit-plugin shall be installed before configuring the job
Running with Jenkins : MacOS documentation, end point configuration contains Windows dir path
unlisted #2

Release notes v0.6.0
listed #3

#4

If you find yourself running Jenkins as a Windows Service but it doesn’t launch the browser during test execution you might want to refer to this topic for further info on how to allow the service to interact with the Desktop.