I discovered an interesting little helper for Github Actions that improves developer experience by making tests easier to parse visually.

First, a quick look at the finished result.


Cool, isn’t it? I was surprised that it was quite easy to set up using test-reporter. It supports a variety of test formats, including java-junit (experimental still).

pytest is able to write a test report in jUnit format using the --junitxml flag (source).

With this feature, we can output a report from out test suite, running pytest --junitxml report.xml. Inside the Github Actions pipeline, the next step picks up the file. We simply define the step as follows:

- name: Test Report
  uses: dorny/test-reporter@v1
  if: success() || failure()    # run this step even if previous step failed
    name: pytest test results            # Name of the check run which will be created
    path: report.xml    # Path to test results
    reporter: java-junit        # Format of test results

This is all that’s needed to generate the output shown in my screenshot. You can find a minimal example for this fun little experiment on Github.