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.
Jenkins installed and started on the computer
Step 1: Create a JAVA project
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.
Step 4: Log in to Jenkins UI
Provide username and password and click on Sign in.
Step 5: Download the Cucumber Report plugin
Click on the Manage Jenkins.
On the Plugins Page, go to the Available option
- Select the Cucumber Report Plugin
- Click on Install without restart. The plugin will take a few moments to finish downloading depending on your internet connection and will be installed automatically.
- You can also select the option Download now and Install after the restart button. In which plugin is installed after the restart
- 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
- Give the Name of the project.
- Click on the Maven project.
- 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 the 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!!