Automation testing, it’s “all” about Continuous Integration. Jenkins is one of my favorite tools. But, what if we can enrich the platform with even better features in which we can have a cool interface, tables and reports that are more simple and easy for understanding. And all that enriched with report generation in HTML format.
We can achieve that by using Allure.(Allure is the right choice)
Allure is an open-source framework designed to create test execution reports that are clear to everyone in the team. It’s a flexible, lightweight multi-language test report tool, with the possibility of adding to the report additional information, such as screenshots, logs etc.
Installing Allure plugin
Let’s assume that we already have installed Jenkins and it’s running. So, first we need to install Allure plugin:
- Go to Manage Jenkins -> Manage Plugins -> “Available” tab.
- Filter for “Allure” and install it without restart.
Adding Allure Command Line tool
In order to generate a report from JSON files we still depend on Allure Command Line tool. Let’s add this tool:
- Go to Manage Jenkins -> Global Tool Configuration -> find Allure CommandLine installations…
- Click on the “Allure CommandLine Installations…”, specify any preferred name and then click on the “Install automatically”.
- From Maven Central, version 2.4.1 is selected, so we click “Save” (new versions are released quite often, so it’s good practice if we check for updates).
Setting Up New Project
Next, what we need to do is to set up a project. First we add the project name, then we connect the project to the repository.
After that we need to add a build step, that builds our project and runs the tests. We choose ‘Invoke top level Maven targets’ as our build step, and we add “clean test” as maven goals.
Then we click Advanced and we add the relative path to our project.
After that we need to run the project, we can notice that the allure reports are not present in the generated report.
That’s because we didn’t add the post build action.
In the post-build actions we should specify the path to the folder where JSON files are stored.
In our case, path is “target/allure-results”.
Now, we can build the project and enjoy the simplicity of our allure reports.
Let’s open allure report.
Allure has a cool feature history trend in which we can follow the trend of success for our application test builds.
If we open “Packages” we can see our packages, classes and the overview of our project build.
That’s it for now.
In the next post we will enrich our reports with adding allure steps, logs and of course, screenshots.
Also we will finalize our posts with evaluation for allure and its use, in favor of our continuous integration automation test reports and easiness of exploring the test results.