Troubleshooting failed test results upload


This article discusses the case where the store_test_results step fail with the following error:

failed uploading test results: File: <path_to_file> had the following problems:
* invalid top level element: <name_of_problematic_element>


How to address this issue

The error you're seeing means that the format of your test results file doesn't fully respect the expected JUnit XML format:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Mocha Tests" tests="3" failures="1">
<testsuite tests="3">
<testcase classname="foo1" name="ASuccessfulTest" time="10" file="src/__tests__/App.test.js" />
<testcase classname="foo2" name="AnotherSuccessfulTest" time="5" file="src/__tests__/App.test.js" />
<testcase classname="foo3" name="AFailingTest" time="1.1050" file="src/__tests__/App.test.js">
<failure type="NotEnoughFoo"> details about failure </failure>

In order to troubleshoot, I suggests storing the file as an artifact, and reviewing its content. Doing so will allow you to identify the incorrect formatting.


Additional Resources

Was this article helpful?
0 out of 0 found this helpful



Article is closed for comments.