VTR
Validator of Test Cases for Software Releases
Validation Strategies
We have five "test-case modifications towards software release" patterns. Here we describe how VTR validate given test cases according to these patterns.
#1: Test Case Identification
VTR monitors JUnit version updates in a Maven-based software project. Since Developers describe dependencies among libraries such as JUnit in a project object model (POM) file in the XML form, VTR parses the XML file to specify the JUnit version used in this project. If the version equals 4.x, VTR then searches Java files located under a "/src/test/java" directory. By parsing these files, VTR finds "public void test*" methods without a Test annotation. If any, VTR suggests developers to add the annotation to these found methods.
#2: Suppress Warnings
To obtain test cases that causing warnings, VTR compile test cases ("$ mvn test-compile"). It then parses the compilation results and finds test cases causing warnings. However, Maven tells only the existence of these warnings, VTR compile each the test case ("$ javac -cp ${CLASSPATH} ${TEST_CASE}") and specify warning information in detail, such as warning type and code location. Note that this pattern is related to the pattern #5.
#3: Expected Exception and Unexpected Timeout
This pattern has two strategies, as follows.
#3.1: Expected Exception
VTR parses the source code of test cases (methods) and detects "try...catch" statements. If the test cases call the JUnit "fail" method, VTR then detect the catch statements and obtains types of expected exception. It finally suggests these test cases to be modified according to this patterns.
#3.2: Unexpected Timeout
It is difficult to determine whether test cases can be timeouted. We implemented a strategy for this pattern based on our strong heuristics. If VTR finds test cases reading static "*TIMEOUT*" variables, it deals with them as the unexpected timeout test cases.
#4: Location of Annotations
VTR parses the source code of test cases (methods). If it found any annotations in the method bodies, it deals with them as test cases to be modified according to this pattern.
#5: Deprecated Assertions
A strategy for this pattern is similar as that of the pattern #2. From the compilation results of test cases, VTR finds test cases that causing warnings. If the locations indicate JUit assertions, VTR categorizes them into test cases to be modified according to this patterns.