Skip to content

burkemw3/turbo-athena

Repository files navigation

Turbo-Athena

Turbo-Athena is a Java class dependency static analysis tool. Teams at Amplify use Turbo-Athena to shorten builds by only running necessary tests.

Usage

Turbo-Athena scans the class and test directories for .class java files and builds a dependency tree between the classes. Turbo-Athena looks for classes in the test directories that reference the org.junit.Test annotation. If the modified classes can affect a test based on the dependency tree, then the test is printed to standard out.

Simple usage:

java -jar turbo-athena-v1.0.0.jar -c $DIRECTORY_WITH_CLASSFILES -t $DIRECTORY_WITH_TEST_CLASS_FILES -m $MODIFIED_CLASS_WITH_PACKAGE

Finding tests to run from git changes:

KNOWN_GOOD_REVISION=abcdef
TEST_REVISION=fedcba
DIRECTORY_WITH_CLASSES=bin/
DIRECTORY_WITH_TESTS=bin/tests
git diff $KNOWN_GOOD_REVISION $TEST_REVISION --name-only \
| egrep -o "burkemw3/.*\.java" | sed -e "s:/:.:g" -e "s:\.java$::I" -e"s:^:-m :" \
| xargs -x java -jar "turbo-athena-v1.0.0.jar" -c "target/test/webdriver"

License

MIT License. See LICENSE file in this directory.

Reasoning

In burkemw3's original search, there were some Java static analysis tools that were similar. The slow builds had tests that had annotations (to run certain fixture data makers for the test) that also needed to be tracked. Other tools did not consider these annotations during dependency analysis.