No XML test reports are generated if all tests are filtered out

It’s sort of normal behaviour, but it turns out that if you end up running no tests, either because there literally are no tests, or because some JUnit runner has filtered them all out, you end up getting no XML reports, even though HTML and binary reports are generated as expected.

The problem is, downstream tools like Jenkins often treat the lack of XML reports as a sign that something more fundamental went wrong, so builds where all the tests were filtered out then spuriously fail.

I was wondering whether there is a good way to configure the test task such that if no tests run, an XML report will still be generated as a placeholder.

Obviously, in the meantime, Jenkins can be configured not to fail if no reports are generated. But that always makes us a little worried that it will start spuriously passing one day when someone changes the test report location or similar.