In this article, I describe how to report JUnit 5 test results (and artifacts/files) with Tesults. I will assume you already have a testing setup with JUnit 5.
Let’s get started.
Step 1 – Sign Up
Tesults is a web-based application which means there is nothing to set up with respect to infrastructure or software but it requires signing up.
Go to Tesults – https://www.tesults.com and sign up.
Step 2 – Create a Project
After signing up, log in and click the settings (middle) icon from the top right menu bar.
This opens settings/configuration. Create a project to start reporting results. Click create a project and name the project.
Finish creating the project by selecting a free or paid plan. A token is provided:
You must copy this token because it is needed later in the code to upload results from pytest.
Step 3 – Add Required Library To Your Java Project
There are three different ways to do this as outlined here:
1. If your project uses Gradle add this to build.gradle file:
2. If your project uses Maven add this to your pom.xml:
3. A JAR can be downloaded from here: https://www.tesults.com/docs?doc=java (where the configuration details can also be found).
Step 4 – JUnit 5 TestExecutionListener
JUnit 5 test execution listeners listen to test events and can be used to gather data about test results. Tesults provides a custom TestExecutionListener to collect results data. Add this class to your project: