The basic Ranorex integration does not require a separate MSBuild step. However, if your continuous integration process requires Jenkins to build the Ranorex solution before test execution, install and configure the MSBuild plugin.
The Jenkins project then performs the following actions:
- Retrieves the Ranorex Studio solution from GitHub.
- Builds the solution with MSBuild.
- Runs the test suite with the Ranorex Test Execution plugin.
- Generates the Ranorex report and displays the results.
Prerequisites
Make sure you have:
- Installed Microsoft Visual Studio or Visual Studio Build Tools.
- Included MSBuild in the Visual Studio installation.
- Installed the Ranorex Test Execution plugin in Jenkins.
- Added the Ranorex Studio solution to a GitHub repository.
Find the MSBuild Installation Path
To locate MSBuild.exe:
- Open PowerShell.
Run the following command:
Get-ChildItem -Path "C:\Program Files (x86)" -Filter "MSBuild.exe" -Recurse -ErrorAction SilentlyContinue
The MSBuild path depends on the installed Visual Studio version and edition. For example:
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\BinInstall the MSBuild Plugin
To install the plugin:
- From the Jenkins dashboard, select Manage Jenkins > Plugins.
- Open the Available plugins tab.
- Search for
MSBuild. - Select MSBuild Plugin.
- Install the plugin.
- Restart Jenkins if required.
Configure MSBuild in Jenkins
To configure the MSBuild installation:
- Select Manage Jenkins > Tools.
- Find MSBuild installations.
- Click Add MSBuild.
- In Name, enter a logical name for the MSBuild installation.
- In Path to MSBuild, enter the MSBuild installation path.
- Click Save.
Create and Configure the Freestyle Project
Create a Freestyle project and configure the GitHub credentials and repository as described in Create and Run a Jenkins Freestyle Project.
Add the MSBuild Build Step
Add the MSBuild step before the Ranorex test execution step.
To add the build step:
- In the Jenkins project configuration, go to Build Steps.
- Click Add build step.
- Select Build a Visual Studio project or solution using MSBuild.
- From MSBuild Version, select the MSBuild installation configured under Manage Jenkins > Tools.
- In Project Path, enter the path to the Ranorex solution file (
.sln).Examples:
MyRanorexSolution.slnandAutomation\MyRanorexSolution.sln
Add the Ranorex Test Execution Step
After the MSBuild build step:
- Click Add build step.
- Select Run a Ranorex test suite.
- Configure the Ranorex test suite or project location.
- Configure the required test execution settings and report options.
- Click Save.
Run the Jenkins Project
To run the project:
- Click Build Now.
Jenkins performs the following actions:
- Checks out the GitHub repository.
- Compiles the Ranorex solution with MSBuild.
- Executes the test suite with the Ranorex Test Execution plugin.
- Generates the Ranorex report.
- Displays the results.