To implement the CI process, let me start with What does Jenkins do?
Jenkins is an open source automation tool that developers can use to build and test software projects, making it simpler for them to incorporate changes.
Jenkins achieves continuous integration with the help of plugins.Every tool that has to be integrated has its own set of plugins
When Maven and Jenkins are connected via plugins, the entire build process may be automated.
Let me walk through the Jenkins dashboard to demonstrate how the test results are connected with the Maven project and how well the plugin management tool is utilised.
Jenkins Dashboard with Sample Maven Project
Dashboard>Manage Jenkins>Global tool Configuration
Set up the JDK,Maven,Github and Allure Report path in Global Configuration settings.
Maven & Allure Installations
To start with installation of plugins let's get started to add some set of plugins in Jenkins dashboard.
Dashboard>Manage Jenkins>Manage Plugins>Available Plugins>Search for the below plugins:
a)Maven Integration Plugin
c)Github API Plugin
d)Allure Jenkins Plugin
Once all the plugins are installed restart the Jenkins, Add New Item> Enter the Project name>select Maven Project>Ok
You will be taken to configuration settings for the new maven project where you can customize some options for the build as seen in below screenshot
Project Configuration Settings
Description: Include a brief description of the project’s specifics, the different methods that were employed etc
Maven Info Configuration: If you want your project to be parameterized you can choose the option ”This project is parameterised” and give choice parameters as needed
Source Code Management: You can choose Git and give some details like project github link(Repository url), Branches to build by default it is master branch, if you added choice parameters as mentioned above, you can add other tests/branches name as required
Git Path Added
Build Environment: To obtain the most recent test results while discarding the older ones, you can select the option “Delete Workspace before build starts” each time the build is launched.
Build:Give the exact location of POM file,that contains the configuration and dependencies for your project, and it’s used to manage the build and various other aspects of the project. You can specify the build goals and options for the chosen build environment. You can customize these goals and options as needed for your specific project requirements
Post-build Actions:This is where you add the reporting section.By installing the appropriate plugins, a multitude of reports can be provided in the post-build actions.
Jenkins provides various reporting and monitoring features to help users track the status of builds, deployments, and other automation tasks. These reporting capabilities are crucial for understanding the health of your CI/CD pipelines and identifying issues or bottlenecks.
Allure Report and Cucumber Report are popular reporting tools used in the context of test automation and behavior-driven development (BDD) testing frameworks. They help provide comprehensive and user-friendly reports about test execution, making it easier to analyze test results.
Cucumber Report: Cucumber is a popular BDD framework, and it also provides built-in reporting capabilities. Cucumber generates reports to document the execution of feature files and scenarios written in Gherkin language.
In order to confirm that the configuration settings were added correctly, click the “save” button at the end.
Let me show the sample screenshots after adding configuration and triggering a build
Build set with Parameters
Successful build with Allure & Cucumber Report
In conclusion, the integration of Cucumber with Maven is a powerful combination that makes writing and running behavior-driven development (BDD) tests for your software projects much easier.
By following these best practices and the integration of Cucumber with Maven, your development team can create a strong and effective framework for BDD testing, which will facilitate the development of software more quickly and reliably.Happy Learning!