Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

JUnit failures are not recognized in Bitbucket Pipelines

Patrick Steiner January 26, 2023

Failures in my JUnit test results are not recognized by Bitbucket Pipelines. The results file is created via fastlane (swiftlint) and looks like this:

<?xml version="1.0" encoding="utf-8"?>
<testsuites><testsuite>
<testcase classname='Formatting Test' name='SomeSwiftFile.swift'>
<failure message='Lines should not have trailing whitespace.'>warning: Line:15 </failure>
</testcase>
</testsuite></testsuites>

 

I also tried an different example file which looks like this:

<testsuite tests="3">
<testcase classname="foo1" name="ASuccessfulTest"/>
<testcase classname="foo2" name="AnotherSuccessfulTest"/>
<testcase classname="foo3" name="AFailingTest">
<failure type="NotEnoughFoo"> details about failure </failure>
</testcase>
</testsuite>

 

It looks like that both files are recognized as junit result files but the failures are not recognized. Take a look at the Bitbucket Pipelines result:

Screenshot 2023-01-27 at 08.06.15.png

 

Any ideas whats wrong here?

1 answer

1 vote
Patrick Steiner January 26, 2023

I think I figured it out, the problem is, that the xml needs the following properties:

 

<testsuite tests="3" skipped="0" failures="1" errors="0">
With this modification the junit xml is recognized correclty.
<testsuite tests="3" skipped="0" failures="1" errors="0">
<testcase classname="foo1" name="ASuccessfulTest"/>
<testcase classname="foo2" name="AnotherSuccessfulTest"/>
<testcase classname="foo3" name="AFailingTest">
<failure type="NotEnoughFoo"> details about failure </failure>
</testcase>
</testsuite>

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events