Integration of Cucumber Report with TestNG in Jenkins

HOME

In the previous tutorial, we have seen the Implemention of ‘Masterthought’ Reports in Cucumber . In this tutorial, we show you how to generate Cucumber Reports with Jenkins

Pre-Requisite:

Jenkins installed and started on the computer

Implementation Steps

Step 1: Create a project for running the tests using Cucumber, Selenium WebDriver, and TestNG

Step 2: Create the Test Code

You can refer to this tutorial to get the test code – Implemention of ‘Masterthought’ Reports in Cucumber.

This framework consists of Selenium, Cucumber, TestNG, and Maven.

Step 3: Start the Jenkins server

Open the browser and navigate to the localhost and the port in which Jenkins is running.

http://localhost:8080/

Step 4: Log in to Jenkins UI

Provide username and password and click on Sign in.

Step 5: Download Cucumber Report plugin

Click on the Manage Jenkins.

On the Plugins Page, go to the Available option

  1. Select the Cucumber Report Plugin
  2. Click on Install without restartThe plugin will take a few moments to finish downloading depending on your internet connection, and will be installed automatically.
  3. You can also select the option Download now and Install after the restarbutton. In which plugin is installed after the restart
  4. You will be shown a “No updates available” message if you already have the Maven plugin installed.

Step 6: Restart Jenkins

Click on the checkbox “Restart Jenkins when installation is complete when no jobs are running“.

The Jenkins is being restarted, It is about to restart.

Again, log in to Jenkins UI.

Step 7: Create a new project using the Maven project plugin in Jenkins

  1. Give the Name of the project.
  2. Click on the Maven project. 
  3. Click on the OK button.

Step 8: In the General section, enter the project description in the Description box.

Step 9: Build Management

Go to the Build section of the new job.

  • In the Root POM textbox, enter the full path to pom.xml
  • In the Goals and options section, enter “clean test”

Click on the Advanced button.

Step 10: Select custom workspace

Mention the full path of the project in the directory.

Step 11: Select “Cucumber reports” from “Post Build Actions

Scroll down to Post Build Actions” and click on the “Add Post Build Actions” drop-down list.

Select “Cucumber reports”

Click on the Advanced button in Cucumber reports.

Enter these details in Cucumber Reports – Mention the Report title and File Include Pattern and click on the “Save” and “Apply” buttons.

We have created a new Maven project CucumberWithTestNG_Demo” with the configuration to run Cucumber Tests and also to generate Cucumber Reports after execution using Jenkins.

Step 12: Execute the tests

Let’s execute it now by clicking on the “Build Now” button. 

Right-click on Build Number (here in my case it is #1) and click on Console Output to see the result.

Once the execution is completed, we could see a link to view the “Cucumber reports“.

Step 13: View the Cucumber Reports

Click on the Cucumber Reports. It displays the summary of the tests.

This way, we could generate a Cucumber Report using Jenkins.

Congratulations on making it through this tutorial and hope you found it useful! Happy Learning!! Cheers!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s