Last active
January 5, 2021 09:48
-
-
Save ufuk/8a1b5f64b225e0485285b551e0679676 to your computer and use it in GitHub Desktop.
Lists test classes descending ordered by elapsed time to find out which ones are slower than others. Run this BASH script at project's root.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Run tests | |
mvn clean test --fail-never | |
# Print header | |
echo | |
echo "TEST NAME, TESTS COUNT, FAILURES COUNT, ERRORS COUNT, SKIPPED COUNT, TIME ELAPSED" | |
# Prepare report | |
filePaths=`find target/surefire-reports -name '*.txt'` | |
for eachFilePath in ${filePaths} | |
do | |
testName=`echo ${eachFilePath} | sed 's/.txt//g' | sed 's/target\/surefire-reports\///g'` | |
testReport=`cat ${eachFilePath} | grep '^Tests run:.*Time elapsed: ' | sed 's/ sec.*//' | sed 's/, /,/g'` | |
testReport=${testName}","${testReport} | |
echo ${testReport} | |
done | sort --field-separator=',' -k6 -r | sed 's/,/, /g' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment