The test history builder is used to create a test history from a collection of trace files. A test history shows which basic blocks were exercised by which test cases, information that is needed by DejaVu for test selection, among other uses. The test history builder currently only works on basic block traces, a limitation we will look to address in the future. To use it, run the command:
java sofya.tools.TestHistoryBuilder -<E|X|C|B> [-tag tag]
<tracedir> <histfile> <classname|listfile>
Instructs the test history builder to include only selected block types in the test history. Allows any combination of the listed values, where E corresponds to virtual entry blocks, X corresponds to virtual exit blocks, C corresponds to call blocks, and B corresponds to all other basic blocks.
Gives the database tag associated with the control flow and map files required by the test history builder. Only necessary if a tag was specified to the CFG builder when constructing the control flow graphs.
Gives the location of the directory containing the traces from which to construct the test history.
Gives the name of the history file to be created.
Gives the name of the class or the program list file containing the list of classes for which the test history is being constructed.
The test history builder will generate a file with the specified name containing the test history information computed from the trace files.
Note: If you use the '
-tag' parameter, the
program list file must also be associated with that tag in the database directory. The traces files, in the tracedir directory, should start their numeration with t0, t1, and so on.
Σοφία provides a tool for reporting the basic block coverage achieved by a test suite. The coverage tool uses a test history file to compute this information, so you must first instrument the program for basic block coverage tracing, collect trace files, and construct the basic block test history as described above. Note that because of the dependency on test histories, Σοφία does not currently support reporting of aggregated branch coverage. Branch coverage can still be derived from individual branch trace files, however. Then you can run the coverage tool with the following command:
java sofya.tools.Coverage <test_history> [-ALL]
The name of the test history file from which to compute coverage data.
This argument instructs the coverage tool to print an output for every block, whether it was covered or not. If omitted, only blocks that were not covered are printed by default.
The previous command will cause the coverage information encoded in the test history to be printed to the console.
A tool is provided with Σοφία that can print a variety of useful statistics about a Java class file, jar file, or program. The statistics tool can be run with the following command:
java sofya.tools.Statistics [-o <outfile>] <classfile|jarfile|listfile>
Specifies a file where the statistical output should be written.
The name of a Java class, jar file, or program list file specifying classes on which the statistics tool should report. Any number of classes, jar files, or list files can be specified, and the statistics tool will report aggregate information for all of the Java classes.
The simplest way to see the types of statistics reported by this tool is to run the tool on a class. This can be accomplished by running the tool on itself:
java sofya.tools.Statistics sofya.tools.Statistics