Step by Step Implementation Cucumber BDD Framework using Java, Selenium, Jenkins, GIT, Allure Part 3
By Gayathri Vimalan
Hi Everyone! Click here for the previous part of the article where we covered how to integrate our project in GitHub Repository. In this part 3 section where we will cover how to run our test in Jenkins.
First let’s try to understand Jenkins.
Jenkins is a continuous integration and continuous delivery (CI/CD) tool and an open source automation server. It helps us to improve the development lifecycle by automating software building, testing, and deployment. It also supports version control tool like Git and build automation tool like Maven.
What is CI and CD?
CI is a continuous integration that ensures each new proposed change does not break existing functionality.
CD is continuous deployment that reduces the work required to deploy new code.
Open this link: https://www.jenkins.io/download
Go to Download Jenkins 2.361.4 LTS for: and click on Windows.
Once the download is complete. Please run the file. You will able to see Setup Wizard. Click Next.
Select the Run service as LocalSystem and click Next.
Select the Port Number and click Next.
Then select the default path and click Next.
Now we will be redirected to a local Jenkins page by default. If page is not loaded by default, paste the URL http://localhost:8080 with the chosen port in the browser.
Next step is to Unlock the Jenkins. For Unlocking Jenkins, copy the password from the file as shown below and open the initialAdminPasswordfile using a text editor. Copy the password and paste in Administrator password field. Click Continue.
Now click on the Install suggested plugins.
Once the plugins are installed then we need to enter the information for creating an admin user account.
Once the admin user account is created, please check if the URL is correct and then click Save and Finish.
Finally we entered into the Jenkins Dashboard page as shown below
Once we login as Admin, we can create multiple users for our team by selecting Manage Jenkins >Manage User >Create User and complete the required fields.
For installing plugins, we can directly download from the Available section of the Manage Plugin.
Navigate to the left side menu > choose Manage Jenkins > click Manage Plugins.
Now under the Available section, enter the name of the plugin in the search bar and click on ‘Install without Restart’. Here I have installed all Maven, Git, Cucumber, Allure related plugins.
Then we have to set up our Global Tool Configuration. For that go to Manage Jenkins > click Global Tool Configuration.
Go to JDK and give name for JDK and and JDK path.
Go to Maven> Add Maven > provide Name and path and click Save.
Now we are going to see how to run test cases using Jenkins.
Go to Dashboard > click New item
Enter the name of the item and select maven project and click ok. Here I have mentioned as “Cucumber Project Demo”
Then we will directed to configure page in General type the description.
In the source Code Management, select Git and mention the URL. We can easily get the URL from Github. The snapshot shown below for better understanding.
Login into Github account and we can see our project click on the project then go to Code and copy the URL.
Then under Pre Steps in Goals and options mention “clean test”
In Post Steps > Post-build Actions >select Allure reports
Copy the allure report path from Eclipse and paste it in Jenkins Post-build Actions and Click Save.
Now to go to Dashboard click on the project and select Build now.
Once we click on the Build Now the build will start and the progress will be displayed as shown below.
And we can able to see the Console Output like this
Go back to the project and we can see Allure reports. Click on the Allure report to see complete report.
That's all !!!
We have successfully ran the test cases through Jenkins and generated Allure report .