Jenkins

Installation and Setup

Follow the steps below to install and set up Jenkins.

  1. Download Jenkins.war from the Jenkins website
  2. Install Jenkins.war using the command: C:\>java –jar Jenkins.war (refer to Starting and Accessing Jenkins for more information)
  3. Install the Github Plugin in Jenkins (refer to this Github Plugin page for more information)
  4. Install the Email Extension Template Plugin (see also Email-ext plugin)
  5. After installation completes, restart Jenkins
  6. Go to ‘Manage Jenkins’ > ‘Configure System’ and verify the Git section is visible as the default setting
  7. Open https://localhost:8080 and go to Manage Jenkins > Configure System
  8. Configure the Git path to the installed location (default in generic case)
  9. Configure the Java path to the installed location (default in generic case)
  10. Configure the ANT path to the installed location
  11. Go to the Extended E-mail Notification section and configure the Default Subject and Default Content (see below for an example)

Scheduling a Job

Step 1: On the Jenkins home screen, click ‘New Item’:

Step 2: Provide an Item Name, select the ‘Freestyle project’ radio button and click OK.


Step 3: Navigate to the Source Code Management section and select ‘Git’. Enter the ‘Repository URL’ and choose credentials (if applicable):


Step 4: To schedule the execution, go to the Build Section and select ‘Add build step’ dropdown. Choose the ‘Invoke ANT’ option.


Step 5: Select ‘ANT version’ and provide ‘Targets’ (if multiple, or leave blank for default). Choose the ‘Advanced…’ option and provide the build.xml path (with respect to project, if it’s in a Git repository):


Step 6: In the Post-build Actions, select ‘Editable Email Notification’. Keep the configuration as default for all fields. In the Attachment section, give the relative path to the testrun chart:


Step 7: Save and Run by choosing the ‘Build Now’ option on the top-left corner to ensure that the scheduled job runs properly.

Viewing Provar’s JUnit execution report in Jenkins

Jenkins understands the JUnit test report XML format. When this option is configured, Jenkins can provide useful information about test results, such as historical test result trends, a web UI for viewing test reports, tracking failures, and so on.

On executing Provar automation scripts via ANT or any CI tool, Provar generates Junit.xml, apart from html and pdf reports. This xml can be configured with Jenkins.

Prerequisites

Jenkins setup with Provar on the server machine. Once done, install Junit Plugin on Jenkins by following below:

Step 1: Go to Jenkins Home > Manage Jenkins

Step 2: Click on Manage Plugins.

Step 3: Search for Junit Plugin and Click on Install.

Step 4: Once installed, restart Jenkins server.

Configure build.xml 

Provar always generates JUnit.xml by default. User does not require to do any specific configuration in the build.xml. One thing to keep in mind that Results, that contains this JUnit.xml, should be generated or placed in Jenkins’ workspace folder.
For example: If the project is inside Jenkins’ workspace, define the results path as:

Configure Job or Item 

To create New Item or job follow this help page. And then follow below steps:

Step 1: Click on the little arrow beside Job Name and select Configure.

Step 2: In the Add post-build action, select Publish JUnit test result report

Step 3: Configure the path of JUnit.xml (generated in the Results folder)

Note: this xml path should be respective to your Jenkins item’s workspace

Step 4: Save and Trigger the job.

Step 5: Once execution completes, you can view JUnit results by clicking on Test Result. (on execution View screen)

Step 6: On the next screen, user will see History link to view the historical view or trend of execution.

Things to keep in mind

  • JUnit.xml should be inside the workspace of the job of Jenkins.
  • Historical data will be visible after at least two execution cycle.
  • Rest of the execution and result format (pdf/html) will remain same.
2017-05-12T11:35:05+00:00

Leave A Comment