JUnit Parser task in Bamboo shows 'Failed to parse test result file' error when parsing test results file

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem

When running the JUnit Response Parser task in Bamboo in a previously generated XML test results file, you may get the following error:

Failed to parse test result file /working_dir/tests_results.xml

Cause

As the error states, Bamboo is unable to parse the test file. This may be caused by:

  1. Incorrect XML format
  2. Invalid characters in the file

Diagnosis and Fix

To fix this problem, it's necessary to identify what in the file is not correct and either make sure it's correctly generated so Bamboo can identify it correctly or add a previous task to fix it (you can use a script task for it). This may include some trial and error.

  1. Validate the generate XML file, to be sure it's in a correct XML format
  2. Check if it's generated in a correct JUnit format
  3. Run the following command to check the file (this may show invalid characters in the file):

    xmllint --noout (--schema schema.xsd) test_results.xml
  4. Run the following command to remove any unprintable characters:

    strings test_results.xml > fixed_test_results.xml

    This command may remove characters you didn't expect to be removed or add new lines characters. This is better used as a diagnosis tool (apply and see if fixed) then a definitive fix. You can compare the two files using this command:

     

    diff test_results.xml fixed_test_results.xml


     

     

Last modified on Jan 29, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.