After a build passes in BitBucket Pipelines the default runner will search a variety of well-known workspace locations trying to locate unit test reports in different formats and display a little counter denoting the number of successful ones. And will fail the build of there are failed ones complete with an explanation text.

Example of Java-based build report which is getting picked up by BitBucket

This pretty much works out of the box for Java-based unit tests, so you’re in luck if Java still is your thing. Not so much though, for the Python builds that I recently did. The tests themselves get properly executed but the reporting back to Bitbucket didn’t seem to work.

In the official documentation a basic Python example is given, which unfortunately only executes the tests located within that file.

Alternatively you can instruct the test loader to search the whole directory and write out compatible report files:

import unittest
import xmlrunner

if __name__ == "__main__":

After that the result will look like this:

Screenshot of Python reports generated by the custom runner being shown