Ant Build Failing with JUnit Tests

My JUnit Parser task fail with "Failing task since test cases were expected but none were found." message.
I configured JUnit Parser with path ${bamboo.build_home}/log/junit/*.xml
From logs:
Substituting variable: ${bamboo.build_home} with /opt/tools/build/current
simple 17-Aug-2017 00:02:47 Starting task 'Get JUnit results' of type 'com.atlassian.bamboo.plugins.testresultparser:task.testresultparser.junit'
simple 17-Aug-2017 00:02:47 Parsing test results under /home/bamboo/bamboo-agent-home/xml-data/build-dir/WEB6-W6IT0-BH...
simple 17-Aug-2017 00:02:47 Failing task since test cases were expected but none were found.
simple 17-Aug-2017 00:02:47 Finished task 'Get JUnit results' with result: Failed

I added script task with command ls /opt/tools/build/current/log/junit/ - i can see TESTS-TestSuites.xml file in /opt/tools/build/current/log/junit/ folder.

Why bamboo try to look tests under /home/bamboo/bamboo-agent-home/xml-data/build-dir/WEB6-W6IT0-BH... folder? It should be /opt/tools/build/current/log/junit/*.xml
How i can see full path for message - /home/bamboo/bamboo-agent-home/xml-data/build-dir/WEB6-W6IT0-BH...?

1 answer

0 votes

Hi Maxim,

By default, files created before the current build will be analysed. As you want to set test results outside the build directory, you will have to enable "Pick up test results that were created outside of this build" under Advanced options in your JUnit Parser task.

It is enabled. The behavior the same for collect test results inside task or as as additional step. I can't get tests results, but i can see test files by ls command.

Hi Maxim, I just tested and found that you can only enter a relative path and navigate within the build directory and never outside a build directory.

Eg. When you enter test-results/*.xml , it looks for xml files under your build directory /home/bamboo/bamboo-agent-home/xml-data/build-dir/WEB6-W6IT0-BH/test-results 

So, the best approach would be copying the files to the build directory. (I'll work with our documentation team to make this clear in the documentation).

PS. When you check Pick up test results that were created outside of this build, it means that Bamboo will no longer verify the timestamp of the xml file creation time whether it is created after the build was started. (I was wrong in my previous update)

I found it ~1 hour ago. I can configure log folder, so i provided environment variable LOG_DIR=${bamboo.build.working.directory}/log. As result all logs and tests results located in build directory and i can see tests results.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Monday in Jira Ops

Jira Ops Early Access Program Update #1: Announcing our next feature and a new integration

Thanks for signing up for Jira Ops! I’m Matt Ryall, leader for the Jira Ops product team at Atlassian. Since this is a brand new product, we’ll be delivering improvements quickly and sharing updates...

533 views 0 9
Read article

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