This guide will help you in setting up Jenkins pipeline to run useMango™ tests. Follow the steps outlined here to run useMango™ tests and view the results.
Prerequisites:
To use Jenkins Pipeline, you will need:
Jenkins 2.x or later.
Pipeline plugin, which is installed as a part of the Suggested Plugins.
useMango Api key use this guide to setup.
Now, to set up the Jenkins pipeline,
Click on Add item and create a Pipeline project in Jenkins.
You will be automatically taken to the Configure page. If not then click on configure option on the left side.
Next, we need to add parameters. Parameters allow you to prompt users for one or more inputs that will be passed into a build. In the General section choose This project is parameterized checkbox. We will need a total of five parameters (3 String, 1 Choice and 1 Boolean parameters). To add the parameters,
Click on Add Parameter and pick String Parameter from the dropdown menu, then enter Project ID as the Name. If the project you’re testing isn’t going to change, you can set a Default Value. The value should be the project ID of the project you are testing in useMango™. You can find the project ID in the Project settings page
For environment specific configurations, add String Parameter named Environment.
Similarly, create another String Parameter to hold tags, name it as Tags.
Next, we need a Choice Parameter. From the dropdown choose Choice Parameter and add the following choices to it:
Create a new Boolean Parameter, name it as Run with datasets and check the Default Value if you always want to run the Jenkins build with datasets.
Scroll down to the Pipeline section and select Pipeline Script from SCM from the Definition dropdown. Select Git from the SCM dropdown menu. In the Repository URL text field, paste the following useMango™ Jenkins public repository URL:
https://github.com/infuse-consulting/jenkins.git
Click on Apply, and Save the changes.
To build the project, go to Build with Parameters, add the parameter values and examine the results.
An example is shown below:
Here, we’re using the JENKINS_DEMO_PROJECT project ID, which contains a large number of useMango™ tests and use the Development_Environment to execute our test on that specific environment. We will run useMango™ tests with the tags automated, jenkins, and jira that are currently marked in Design status, and we will use the Run with datasets parameter to run tests with datasets.
For the first time you are running tests via jenkins you will need to approve scripts.
You will need to repeat steps 1-4 for few times as the scripts are approved on individual basis.
If you are not familiar with the process of viewing test results in Jenkins, you can learn more about it here.