Skip to content

Instantly share code, notes, and snippets.

@xpepper
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save xpepper/d35863b6c9cb0765ac2a to your computer and use it in GitHub Desktop.
Save xpepper/d35863b6c9cb0765ac2a to your computer and use it in GitHub Desktop.
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
Copy link
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