Postman:
Postman is a widely used API testing tool that offers a user-friendly graphical user interface (GUI) for creating, managing, and executing API tests. It provides a comprehensive set of functionalities that make testing APIs more efficient and effective. Postman's API Builder tool allows users to design their API before development, and then connect the API definition to other elements of the API development lifecycle, such as documentation, tests, and collections. Users can also import definitions from connected Git repositories, such as GitHub, GitLab, Bitbucket, or Azure DevOps.
Git:
Git is a DevOps tool used for source code management. It is a free and open-source version control system used to handle small to very large projects efficiently. Git is used to tracking changes in the source code, enabling multiple developers to work together on non-linear development.
Jenkins:
Jenkins is a Java-based open-source automation platform with plugins designed for continuous integration/continuous delivery and deployment(CI/CD). It is used to continually create and test software projects, making it easier for developers and DevOps engineers to integrate changes to the project and for consumers to get a new build. It also enables you to release your software continuously by interacting with various testing and deployment methods.
Newman:
Newman is a command-line collection runner for Postman. It allows you to effortlessly run and test a Postman collection directly from the command-line. It is built with extensibility in mind so that you can easily integrate it with your continuous integration servers and build systems. Newman resides in the npm registry and on GitHub.
Allure Report:
Allure Report benefits different team members by providing clear, detailed, and visually engaging test reports that enhance collaboration, issue resolution, and overall project quality. It's an open-source, multi-language tool that helps create visually appealing test reports. It can be used to provide a detailed representation of what has been tested and extract information from test execution. Allure Reports are known for their user-friendly interface and rich text formatting, screenshots, and step-by-step breakdowns.
Newman HTML Report:
HTML reporter for Newman that provides the information about the collection run in HTML format. This needs to be used in conjunction with Newman so that it can recognize HTML reporting options. It generates HTML reports from API test results. It can help stakeholders review test results and debug failed tests by capturing detailed request and response fields, such as headers, bodies, and parameters.
Pre-requisites:
· Postman Collection & Environment json files should be pushed into Git.
· Installed node.js & Allure in local.
· In Environment variables, set path for node & allure.
· The Jenkins server is running.
Jenkins Installation and Configuration Steps:
1. Install the plugin
2. Install the global tool
3. Configuring as a freestyle project
1. Install the plugin:
· To Install Allure Jenkins, HTML Publisher, Git & NodeJS Plugins.
· In the Jenkins web interface, goto Dashboard -> Manage Jenkins -> Plugins -> Available Plugins
· Using the search box, find the “Allure Jenkins”/ “HTML Publisher”/ “Git”/ “NodeJS” plugin. Check the checkbox next to the plugin.
· Click Install without restart.
· On the Download progress page, wait until each status is ”Success”.
· After the installation, the plugin will appear in the Manage Jenkins → Manage Plugins → Installed plugins section. you can check the installed git, Allure Jenkins, NodeJS, HTML Publisher.
2. Install the global tool
· The second necessary part of the installation process is adding the “Allure command-line”/ “nodejs” utility to Jenkins as a “global tool”. Once added, Jenkins will take care of downloading the utility to every machine that needs to build a test report. The “Allure Report”/ “nodejs” plugin provides an easy way to download and add the latest version of the global tool from the official server.
· To install, go to Dashboard -> Manage Jenkins -> Tools -> NodeJS installations configuration,
· To install, go to Dashboard-> Manage Jenkins-> Tools-> Allure command-line installations configuration,
· Click Apply & Save.
3. Configuring as a freestyle project
· To create freestyle project, goto Dashboard->New Item-> Enter Project name, select Freestyle project-> click ok
· Goto Dashboard-> select the Project-> In the menu on the left-> click Configure.
· Under the Source Code Management section, check Git option button and specify the Repository URL, Branch specifier details.
Under Build Environment, check Delete workspace before build starts checkbox to cleanup the workspace.
· In Build Steps-> Add build step-> Select ‘Execute Window batch command’ for windows
· To build the postman collection & generate reports using newman. Enter the following command in the build steps.
· “newman run collection_filename.json -e environment_filename.json -d data_filename.csv -r allure,htmlextra,cli — reporter-htmlextra-export report.html — disable-unicode”
· Under Post-build Actions section, click add Post-build Actions->Allure Report.
· In the Results-> path, specify the path to the results directory
· Under Post-build Actions section, click add Post-build Actions-> Publish HTML reports
· In the Reports-> Index page, specify the output HTML file name.
· Click Apply & Save to complete the configuration.
· Now, click Build Now to run the build configuration, You will be able to view the results in Allure & HTML report.
In conclusion, it's very simple to integrate Postman, Git, and Jenkins and generate Newman HTML and Allure reports. Thank you for joining me on this journey, be sure to check out my other posts, and I look forward to sharing more insights with you in future posts. Until then, keep learning, growing, and embracing the adventure!