This project will give some examples of usage of some Program Analysis Tools, which are briefly introduced as follows,
JUnit is the most widely used Java testing framework
, it provide the differeny strategies of testing. Here we focus on the JUnit 4 version.
Note:
a. The latest junit-4.12.jar should be used combining with hamcrest-all-1.3.jar, so please add them all to the classpath of the project.
b. We can simply use some specific notations to guide the execution of test suite, for example, we use @test to declare a test case, we use @RunWith to add test cases to one suite, we use @FixMethodOrder to set the execution order of test cases.
Website: http://junit.org/junit4/.
Javaslicer is a dynamic backward slicing tool
for Java code, it can give the slices(relavent statements) of specific lines or variables. Note that Javaslicer only support JDK 1.6 and 1.7(but NOT JDK1.8). Additionally, we'd better use this tool on Linux platform.
Note:
a. The limitation of Javaslicer is its ability of dealing with large-scale progjects, because even a small Java class can generate a big trace file. So it might throw a exception of "too large".
b. Two step to use Javaslicer: (i) generate the trace file, (ii) read the trace file and slice the program.
Website: https://github.com/hammacher/javaslicer.
Spoon is an open-source Java analysis and transform tool
, which is widely used in program analysis, feature extraction, program mutation etc.
Website: http://spoon.gforge.inria.fr/.