Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A shell script to extract from Jenkins the top slowest tests

Just connect to your Jenkins instance, localize the junit tests report folder (e.g. /data/jenkins/jobs/Jeronimo/workspace/Repository/target/surefire-reports) and then issue this shell command:

grep -h "<testcase" `find . -iname "TEST-*.xml"` | sed 's/<testcase name="\(.*\)" classname="\(.*\)" time="\(.*\)".*/\3\t\2.\1/' | sort -rn | head
echo `date` >> /tmp/slower_tests.txt
echo "" >> /tmp/slower_tests.txt
cd /data/jenkins/jobs/IntegrationTest/workspace/Integration/target/failsafe-reports
grep -h "<testcase" `find . -iname "TEST-*.xml"` | sed 's/<testcase name="\(.*\)" classname="\(.*\)" time="\(.*\)".*/\3\t\2.\1/' | sort -rn | head -n 15 >> /tmp/slower_tests.txt
echo "" >> /tmp/slower_tests.txt
cd /data/jenkins/jobs/Jeronimo/workspace/Repository/target/surefire-reports for unit tests
grep -h "<testcase" `find . -iname "TEST-*.xml"` | sed 's/<testcase name="\(.*\)" classname="\(.*\)" time="\(.*\)".*/\3\t\2.\1/' | sort -rn | head -n 10 >> /tmp/slower_tests.txt
echo "" >> /tmp/slower_tests.txt
@xpepper

This comment has been minimized.

Copy link
Owner Author

xpepper commented Jan 16, 2015

  • /data/jenkins/jobs/Jeronimo/workspace/Repository/target/surefire-reports for unit tests
  • /data/jenkins/jobs/IntegrationTest/workspace/Integration/target/failsafe-reports for integration tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.