JUnit Parser: Test results are not found
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Even though the files exist, build fails with:
simple 21-Jun-2013 18:03:32 Failing task since test cases were expected but none were found.
Or:
Could not find test result reports in the C:\Users\ssetayeshfar\bamboo-home-445\xml-data\build-dir\PROJECT-PLAN-JOB directory
Cause
Bamboo checks for the test result too quickly. See BAM-12979 - Test file date check not forgiving enough
Solution
Bamboo uses a system property bamboo.fs.timestamp.precision
to define FS timestamp resolution. By default it is set to 100 (ms), please set it to a higher value in order to make file date check less strict. Bamboo does check-in the following way:
private boolean isFileRecentEnough(final File file)
{
return file.lastModified() >= (taskStartDate.getTime() - SystemProperty.FS_TIMESTAMP_RESOLUTION_MS.getTypedValue());
}
Other items to check
- Double-check the task configuration and confirm that it is configured to look for the test results file in the current working directory of the job (Ex.: C:\Users\ssetayeshfar\bamboo-home-445\xml-data\build-dir\PROJECT-PLAN-JOB) and NOT a sub-directory (Ex. C:\Users\ssetayeshfar\bamboo-home-445\xml-data\build-dir\PROJECT-PLAN-JOB/test-results).
- In case the test report is not produced by the build (it was produced earlier) use a 'touch' command right before the JUnit task.
Note: In cases that test results are somewhat produced from a script task that uses operations like copy or move, they should place the XML file in the repository for it to be checkout to your working directory and then use the parser directly.