Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor and fix test-triangle examples
Add: * Documentation for the test scripts Fix: * Scripts so that the tests would pass Refactor: * Format to better separate the tasks * Output of results to be more apparent
- Loading branch information
1 parent
125fbf5
commit e2c2671
Showing
2 changed files
with
61 additions
and
16 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,58 @@ | ||
#! /bin/bash | ||
VERSION=`grep "<version>" pom.xml | head -1 | sed -E 's/.*0/0/' | sed -E 's/<.*//'` | ||
DIST=javalanche-$VERSION | ||
|
||
# Set up test example | ||
cd ${DIST}/examples/triangleJunit4 | ||
JAVALANCHE_ARGS="-Dprefix=triangle -Dcp=target/classes -Djavalanche=../../ -Dtests=triangle.tests.Triangle1Test:triangle.tests.Triangle2Test:triangle.tests.Triangle3Test" | ||
ant test | ||
cp ../../javalanche.xml . | ||
|
||
# Variables representing the two test's properties and their output locations | ||
OUT1=out-mutationTest-1.txt | ||
OUT2=out-mutationTest-2.txt | ||
cp ../../javalanche.xml . | ||
ant -f javalanche.xml $JAVALANCHE_ARGS mutationTest | tee ${OUT1} | ||
sed -iBACK 's/<project name="Javalanche">/& \ | ||
<property name="prefix" value="triangle"\/> \ | ||
<property name="tests" value="triangle.tests.TriangleTestSuite"\/> \ | ||
<property name="javalanche" value="..\/..\/"\/> \ | ||
<property name="cp" value="target\/classes"\/> /' javalanche.xml | ||
<property name="cp" value="target\/classes"\/> /' javalanche.xml | ||
JAVALANCHE_ARGS="-Dprefix=triangle -Dcp=target/classes -Djavalanche=../../ -Dtests=triangle.tests.Triangle1Test:triangle.tests.Triangle2Test:triangle.tests.Triangle3Test" | ||
|
||
# Test 1: using javalanche.xml properties with JUnit TestSuite | ||
ant -f javalanche.xml $JAVALANCHE_ARGS mutationTest | tee ${OUT1} | ||
|
||
# Test 2: using CLI arguments with JUnit Tests (composes testsuite) | ||
ant -f javalanche.xml mutationTest | tee ${OUT2} | ||
|
||
# Clean up test | ||
ant clean | ||
rm javalanche.xml | ||
|
||
SAME="Same output for both runs" | ||
# Variables required for the comparison of the output | ||
SAME="Successful: Same output for both runs" | ||
GREP1_1="$(grep "Mutation score:" ${OUT1})" | ||
GREP1_2="$(grep "Mutation score:" ${OUT2})" | ||
GREP2_1="$(grep "Covered mutations" ${OUT1})" | ||
GREP2_2="$(grep "Covered mutations" ${OUT2})" | ||
|
||
# Output the test results | ||
echo "-------------------------------------" | ||
echo "Testing Mutation Score" | ||
if [ "$GREP1_1" == "$GREP1_2" ] | ||
then | ||
echo ${SAME} | ||
else | ||
echo Error: Mutation score not equal. ${GREP1_2} - ${GREP1_1} | ||
fi | ||
|
||
GREP2_1="$(grep "Covered mutations" ${OUT1})" | ||
GREP2_2="$(grep "Covered mutations" ${OUT2})" | ||
echo "" | ||
echo "Testing Covered Mutations" | ||
if [ "$GREP2_1" == "$GREP2_2" ] | ||
then | ||
echo ${SAME} | ||
else | ||
echo Error: Covered mutations not equal. ${GREP2_2} - ${GREP2_1} | ||
fi | ||
|
||
|
||
# Clean up output files | ||
rm ${OUT1} | ||
rm ${OUT2} |
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