-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·63 lines (52 loc) · 1.33 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh
DEP_DIR="dependencies"
EXAMPLE_DIR="examples/$1"
TEST_TOOL="$2"
print_usage_and_exit()
{
echo "Usage: ./run.sh [example1|example2|...] [junit|pit|jumble]"
exit 0
}
#check if we have the correct number of arguments
if [[ $# -ne 2 ]]; then
print_usage_and_exit
fi
# check if we have a real example folder
if [ ! -d $EXAMPLE_DIR ]; then
echo "$EXAMPLE_DIR does not exist."
print_usage_and_exit
fi
# check if we have a supported test tool
case $TEST_TOOL in
junit) ;;
pit) ;;
jumble) ;;
*) echo "$TEST_TOOL is not a supported test tool."
print_usage_and_exit
;;
esac
# compile
CLASSPATH=$DEP_DIR/*
javac -cp "$CLASSPATH" $EXAMPLE_DIR/*.java
# run
CLASSPATH=$CLASSPATH:.
PACKAGE=examples.$1
case $TEST_TOOL in
# vanilla JUnit
junit) java -cp $CLASSPATH $PACKAGE.TestSuite
;;
# PIT mutation testing
pit) java -cp $CLASSPATH \
org.pitest.mutationtest.commandline.MutationCoverageReport \
--reportDir ./reports \
--sourceDirs . \
--targetClasses $PACKAGE.Snippet \
--targetTests $PACKAGE.TestSuite
;;
# Jumble mutation testing
jumble) java -jar $DEP_DIR/jumble_binary_1.3.0.jar \
--classpath $CLASSPATH \
$PACKAGE.Snippet \
$PACKAGE.Tests
;;
esac