Best way to handle non-zero exit code from test results

I have a test suite which return a non-zero exit code if there is one or more failing test.

The test suite is running Perl 'prove' command using `--harness TAP::Harness::JUnit` to format the results as JUnit.

The logs report that the task is set to fail because an exit code of 1 has been reported in the sub-process.

Test Summary Report
09-Sep-2013 11:30:48 -------------------
09-Sep-2013 11:30:48 t/Exl/Portfolio/PortfolioService.t (Wstat: 256 Tests: 8 Failed: 1)
09-Sep-2013 11:30:48 Failed test: 8
09-Sep-2013 11:30:48 Non-zero exit status: 1
09-Sep-2013 11:30:48 Files=1, Tests=8, 3.01914 wallclock secs ( 0.02 usr + 0.03 sys = 0.05 CPU)
09-Sep-2013 11:30:48 Result: FAIL
09-Sep-2013 11:30:48 Failing task since return code of [C:\opt\Atlassian\Bamboo\temp\EF-EDS-JOB1-20-ScriptBuildTask-1386811734320945865.bat] was 1 while expected 0

As a result I get the final status of:

No failed tests found, a possible compilation error occurred.

and test results are not parsed.

I have tried adding an `exit \B 0` to my script task but this does not seem to work.

I have tried adding system parameters to a wrapper.conf file that I have created in the \conf sub-directory as per,+even+though+they+were+successful


The file contains this:

atlassian.bamboo.builder.successMarker=Result: PASS
atlassian.bamboo.builder.failedMarker=Result: FAIL

Is there anything that I can do to get the JUnit Parser to parse the test results if a non-zero exit code is returned. See also this discussion:!topic/cukes/w86pPYPtc5k

1 answer

1 accepted

1 vote
Accepted answer

Sultan at Atlassian support solved this for me. In the task I set the checkbox 'Run as PowerShell script' to true. I then set my script as

cmd /c path_to_my_batch_file.bat

and results are correctly parsed. This looks like a workaround - but it achieves the result.

HI Ross, In my case I'm getting following error. I'm following guideline suggested here:

31-Jan-2017 02:16:53 FAILURE: Build failed with an exception.
31-Jan-2017 02:16:53
31-Jan-2017 02:16:53 * What went wrong:
31-Jan-2017 02:16:53 A problem occurred configuring project ':app'.
31-Jan-2017 02:16:53 > java.lang.NullPointerException (no error message)
31-Jan-2017 02:16:53
31-Jan-2017 02:16:53 * Try:
31-Jan-2017 02:16:53 Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
31-Jan-2017 02:16:53
31-Jan-2017 02:16:53 BUILD FAILED
31-Jan-2017 02:16:53
31-Jan-2017 02:16:53 Total time: 1 mins 2.42 secs
31-Jan-2017 02:16:53 Failing task since return code of [/bin/sh /var/folders/m9/03dpsmkd009gfygtdzx86m800000gn/T/ ANDROID_HOME=/Users/shubham/Library/Android/sdk] was 1 while expected 0
31-Jan-2017 02:16:53 Finished task 'Droid Build Script' with result: Failed
31-Jan-2017 02:16:53 Running post build plugin 'Docker Container Cleanup'
31-Jan-2017 02:16:53 Running post build plugin 'NCover Results Collector'
31-Jan-2017 02:16:53 Running post build plugin 'Clover Results Collector'
31-Jan-2017 02:16:53 Running post build plugin 'npm Cache Cleanup'
31-Jan-2017 02:16:53 Running post build plugin 'Artifact Copier'
31-Jan-2017 02:16:53 Finalising the build...
31-Jan-2017 02:16:53 Stopping timer.


Could you please check, what I'm missing.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Organizing your space just got easier - Page Tree Drag & Drop is here

Hi Community! I’m Elaine, Confluence Product Manager. You may have read my earlier post about page tree in space navigation sidebar. I'm excited to share another improvement that helps you organize ...

58 views 3 2
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you