Documentation

Looking for something in particular?

Setting up Continuous Integration with Jenkins for Docker

Setting up Jenkins and Docker Continuous Integration for your Provar project is always recommended. This will help you schedule test runs, get consistent reporting, and execute test cases on a remote server. The following help page(s) can walk you through that process from start to finish:

You can follow this help page to help you set up Jenkins for Provar using Jenkins Build Pipelines:

Another helpful way of executing builds in Jenkins using declarative and scripted pipelines is there. These are pipelines that are created through a scripting language called Groovy. Here is an example Jenkinsfile that will execute your Provar tests inside the docker container generated by your Dockerfile.

Sample of Jenkins File


pipeline {

    agent {

        dockerfile true

    }

    stages {

        stage('Run Provar Tests') {

            steps {

                echo "Running ${env.BUILD_ID} on ${env.JENKINS_URL}"       

                sh "xvfb-run ant -f ANT/build.xml -v"

            }

        }

    }

    post {

        always {

            junit allowEmptyResults: true, testResults: 'ANT/Results/*.xml'

            cleanWs notFailBuild: true /* cleans up the workspace */

        }

        success {

            echo "Success: Good job!"

        }        

        failure {            

            echo 'Failure: Something went wrong with the Provar ANT build. Printing environment for debugging'            

            sh 'printenv'

            echo 'Printing hosts'

            sh 'cat /etc/hosts'

            echo 'Searching for provar directories/files in the system...'

            sh 'find / -name "provar*"'

            echo 'Finding chrome drivers'

            sh "find / -name '*chromedriver*'"

        }        

    }   

}

This Jenkinsfile assumes that your build.xml file is located in the ANT folder of your test project and is named ‘build.xml.’ You can read more about them here:

https://jenkins.io/doc/book/pipeline/jenkinsfile/

17 Easy Steps to Setup Jenkins Pipeline to Execute Provar Test

Follow these steps to set up a Jenkins pipeline using a Jenkinsfile that executes your Provar tests inside the docker container (assuming you have an accessible Jenkins instance that can communicate with your Version Control System).

Step 1: Ensure you have run the tests locally inside the docker container.

Step 2: Ensure your Jenkinsfile and Dockerfile are in the project’s root directory. If your Jenkinsfile is not in the root folder, set its relative location in step 12.

Step 3: Check your Provar test project into a Version Control System (VCS).

Step 4: Select New Item on your Jenkins home page to create a new project and then select Pipeline.

On your Jenkins home page, select New Item to create a new project and then select Pipeline.

How to add a project for your Jenkins and Docker Integration

Step 5: Click Ok to create the project and then select the Pipeline tab to navigate to the Pipeline section.

image shows creating the project and selecting the Pipeline tab to navigate to the Pipeline section.

Step 6: Select the dropdown field and change to Pipeline script from SCM. You can also paste the Jenkinsfile into this block if you select Pipeline script. However, if you go down this road, you must add a step in the Jenkinsfile to pull your project files from your VCS/SCM.

Image shows a dropdown field menu when choosing a pipeline

Step 7: Change the SCM dropdown to match where your project is checked.

Step 8: Enter the repository URL (with the .git ending if using Git SCM).

Step 9: You must also add credentials to your Jenkins instance to connect to this repository. Click the Add dropdown and select Jenkins. You can authenticate this repository however you like, i.e., using a token or username/password. You should always give the Credentials you save a recognizable ID and Description.

Sample of adding Jenkins Credentials in your Jenkins pipeline for your Jenkins and Docker integration

Step 10: Specify the branch you would like to access, if applicable (default is master for repository with a single branch).

Step 11: (Optional) In the Additional Behaviours section, select Add and select Clean before checkout and Clean after checkout. This will ensure you have a clean environment each time this project is built.

Step 12: Provide the relative path to your Jenkinsfile from the repository’s root directory. This will be ‘Jenkinsfile’ unless you did not place your Jenkinsfile in your project’s root and the repository structure does not reflect your Provar test project structure.

Step 13: Here is the final Pipeline section once completed:

This is how final Pipeline appears when section once completed

Step 14: Click Save unless you would like to set any other Project properties first.

Step 15: It is always a good idea to run a validation build on this project to ensure everything works properly. Select Build Now after saving.

running a validation build on Jenkins for Provar project in Docker

Step 16: After a brief moment, you should see the project being built and can monitor its status by selecting the arrow by the build number and selecting Console Output.

After a brief moment, you should see the project being building and can monitor its status by selecting the arrow by the build number and selecting Console Output

Step 17: You should see a successful test run, assuming your tests pass beforehand. Select Test Result from the build view page.

ou should see a successful test run after checking test result

This article guide should be able to help you with your Jenkins and Docker Integration for your Provar projects.

Review Provar on G2
Documentation library

Trying to raise a case with our support team?

We use cookies to better understand how our website is used so we can tailor content for you. For more information about the different cookies we use please take a look at our Privacy Policy.

Scroll to Top