Last active
September 26, 2018 12:43
-
-
Save rybak/96e87a25ed9926d851417aa39abad955 to your computer and use it in GitHub Desktop.
TeamCity generates a CSV file with list of all run tests. Sometimes it is useful to compare these lists on different builds. This scripts helps to do just that.
This file contains 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
#!/usr/bin/bash | |
# | |
# MIT License | |
# Copyright (c) 2018 Andrei Rybak | |
# | |
set -u | |
set -e | |
extract_full_tests () { | |
# extracts just the full test names (deletes metadata, like run time) | |
cut -d, -f2 "$1" | sort | |
} | |
extract_names () { | |
# extracts just the class name and method name | |
grep -o '[A-Z].*$' "$1" | sort | |
} | |
extract () { | |
local FILE="$1" | |
local NAME=$(basename "$FILE") | |
local FULL="/tmp/${NAME}.full" | |
TESTS="/tmp/${NAME}.tests" | |
extract_full_tests "$FILE" >"$FULL" | |
extract_names "$FULL" >"$TESTS" | |
rm "$FULL" | |
} | |
readonly FIRST="$1" | |
readonly SECOND="$2" | |
extract "$FIRST" | |
readonly FIRST_TESTS="$TESTS" | |
extract "$SECOND" | |
readonly SECOND_TESTS="$TESTS" | |
git diff --no-index --color-words='[A-Za-z]+' "$FIRST_TESTS" "$SECOND_TESTS" | |
rm "$FIRST_TESTS" | |
rm "$SECOND_TESTS" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment