show-tests
Find and open test results from gradle (and pre-gradle grails) builds.
Usage:
# root module
$ show-tests :
# sub-module
$ show-tests module
# specialized test sourceSet
$ show-tests module integration
Add this to ~/.bashrc
show-tests() {
if [[ ":" == "$1" ]]; then
shift
show-tests-immediate "$1"
elif [[ -d "$1" ]]; then
path=$1
shift
$(cd "$path" && show-tests "$@")
else
for path in $(find . -name build.gradle); do
$(cd `dirname ${path}` && show-tests-immediate "$@")
done
fi
}
show-tests-immediate() {
for directory in "target/test-reports/html" "build/reports/tests"; do
if [[ -e "$directory" ]]; then
find "$directory" -name "index.html" -print0 | while IFS= read -r -d $'\0' line; do
if [[ "$line" == *"$1"* ]] || [[ "$(basename `pwd`)" == *"$1"* ]]; then
open "$line"
fi
done
fi
done
}
Requires the open command (OSX), ymmv, if you have xdg-open you may try adding alias open=xdg-open