Azure Pipelines let you build, test, and publish artifacts from your repository. This article explains how to create a classic Azure DevOps pipeline that builds a Ranorex Studio solution and runs the resulting test executable on an Azure Pipelines agent.
Use this workflow if your organization uses classic pipelines or if you prefer to configure pipeline tasks through the Azure DevOps web interface.
Before you begin
Make sure you have:
- An Azure DevOps project and Git repository are set up. See Create ADO project & Git repo.
- A configured and running agent is available for your pipeline. See Set up an Azure Pipelines agent.
- A Ranorex Studio solution committed and pushed to your Azure Repo.
- Permission to create pipelines in your Azure DevOps project.
Create a pipeline
To create a new pipeline for your Azure DevOps project:
- In your Azure DevOps project, select Pipelines in the left navigation.
- Select New pipeline.
- Choose Use the classic editor.
-
Under Select a source, choose Azure Repos Git, select your repository, and keep the default branch as needed. Select Continue.
- Choose the template .NET Desktop, then select Apply.
Pipeline overview
The pipeline overview shows the components that make up the pipeline.
- Configuration categories of a pipeline. In the image, Tasks is selected.
- Basic pipeline configuration. Here you can give the pipeline a name, set the agent pool, and set optional parameters.
- Here you can configure the sources (i.e. repositories) the pipeline uses. This corresponds to what we did in Create a pipeline above.
- A pipeline always contains at least one agent job. This is the logical set of tasks that the pipeline carries out.
- An agent job always contains at least one task. Tasks are carried out in the order they appear under the agent job.
- The configuration window. Configuring one of the above items brings up this window. In the image, the window for configuring the agent job is shown.
Configure the Pipeline
Under Tasks, select Pipeline (top node) and review:
- Name (optional)
- Agent pool (must match the pool where your configured agent is available)
- Template parameters such as the solution pattern (often
**/*.sln)
- Change the pipeline name.
- Select the agent pool for the pipeline. You can use the default local pool or choose from a range of hosted pools that have various images already set up.
- Set optional pipeline parameters. The preset parameter in the image builds the executable from the Visual Studio solution file (.sln file ending).
Build the Ranorex Studio solution
The Visual Studio build task builds your solution and creates the test executable in the project output folder.
Recommended configuration:
- Keep the Visual Studio build task from the .NET Desktop template.
- Set Platform to x86, if required by your Ranorex Studio solution.
- Confirm that the solution pattern points to your Ranorex Studio solution.
Run the Test Executable
To run the built Ranorex Studio test executable, add a command-line task to the agent job.
- Click the + symbol next to the agent job.
- In the search bar, enter command line.
- Click Add.
In Script, enter the path to your test executable (example below).
Example script:
- System variable for the current working directory of the Azure DevOps project.
- Folder for the Ranorex Studio solution.
- Folder for the Ranorex Studio project in the solution.
- Default output folder for Visual Studio projects.
- File name of the executable build. You can add further optional arguments to the .exe.
Reporting
By default, the Ranorex report isn’t easy to access from the run summary unless you publish it as an artifact.
- Add Publish build artifacts task
- Type a Display name
-
Path to publish:
$(System.DefaultWorkingDirectory)\Reports\ -
Artifact name: for example,
Ranorex Test Report
After a run completes, you can download/open the artifact from the run summary.
Once a pipeline has finished, you can see the report in the summary and open it from there.
- Click Pipelines > Builds.
- Click Summary.
- Under Build artifacts published, click the item. It will have the name you specified in the task.
Show test results in the build results
To display results under the Tests view, generate a JUnit-compatible report and publish it:
- Add a Publish test results task.
- Type a Display name
-
Test result format:
JUnit -
Test results files:
**/*.junit.xml -
Search folder:
$(System.DefaultWorkingDirectory)
Update your Command line script to include JUnit + zipped report output, for example:
-
- The executable build of the Ranorex Studio solution.
-
/junitcreates a JUnit-compatible report (.junit.xml). -
/zrcreates a zipped report. -
/zrf:...sets the output path/name for the zipped report.
Result
Under Pipelines > Builds > Tests, you can see various test details after a build has been executed.
Use the official Ranorex Azure DevOps build task
Instead of manually adding the tasks above, you can install the Ranorex Azure DevOps build task extension from the Azure DevOps Marketplace and configure Ranorex execution through a single task.
This task generates the required Ranorex command-line arguments based on your settings, so it behaves like running the test executable from the command line.
- Display the name of the task.
- Task settings controlling the integration with Ranorex Studio. We explain these below.
General settings
- The relative path from the repository folder to the test executable in the output folder of your Ranorex Studio solution. Required.
- The relative path from the repository folder to a specific test suite file (.rxtst) in the output folder of your Ranorex Studio solution. Useful if your test contains several test suites and you only want to run one of them.
-
The run configuration that will be used for the test run. Enter exactly as it is named in the run configuration manager in Ranorex Studio. Useful if you have more than one run configuration.
Reporting
- Enables reporting, i.e., a Ranorex Studio report will be attached to the build.
- Allows you to enter a custom report name. You can use report-specific placeholders, explained here under Reporting.
-
The minimum report level that events must have to be included in the report. (Default) uses the report level setting that was active when the solution was built in Ranorex Studio. Report levels are explained here.
TestRail integration
These options allow you to pass test results to a TestRail instance. - Enables reporting test results to TestRail.
- Enter the service connection for your TestRail instance. If you don’t have one yet, you need to configure it in Azure DevOps under Project Settings > Service connections > New service connection > Generic. There, enter your TestRail credentials. You can also click the Manage link next to the field to get to the Service connections menu.
- The identifier of an existing test run in TestRail to report test results to. If you don’t specify an ID or it doesn’t exist, results will be reported to a new test run.
- Creates a new test run in TestRail with the specified name to report test results to. Without this argument the default name is used.
Advanced
Here you can specify additional command line arguments to customize the test run. All available command line arguments are explained here.
Run the pipeline
To execute a pipeline, you need a configured Azure Pipelines agent.
- Go to Pipelines, select your pipeline, and select Run.
- Review settings and select Run.
While the run is in progress, Azure DevOps shows task-by-task progress. On the agent machine, the agent window also shows the job being executed.
Pipeline progress view
The pipeline will carry out all tasks in the specified order. You can view the progress in Azure DevOps.
- Indicates that a pipeline has been started
- Start time and elapsed time
- Completed tasks
- Current task, including debug info
Agent window
Once you’ve started a pipeline, the agent job is passed to the agent, which then runs it. The agent window will show that a job has been started.
Ranorex Studio test run
The agent runs the Ranorex Studio test as if it were started from within Ranorex Studio.
Pipeline completion
When a pipeline has been completed, it displays in the pipeline overview.
- List of all created pipelines for the current project
- List of all builds in the selected pipeline, including execution stats (success/failure)
- Click the build to display the results view for it
After completing a job, the agent shows the result and then returns to idling.
Trigger a pipeline automatically
You can also trigger pipelines automatically. To do so, you need to enable the option Enable continuous integration. Any changes to the Ranorex Studio solution committed and pushed to Git will then trigger the respective pipeline. To enable this option:
- Open your pipeline and select Edit.
- Select Triggers.
-
Enable continuous integration.