-
Notifications
You must be signed in to change notification settings - Fork 15
CLI
André Silva edited this page Jul 6, 2021
·
15 revisions
Displayed below is the full reference of flacoco CLI. You can always obtain this information by running flacoco with the option --help
.
Usage: FlacocoMain [-hVv] [--coverTest] [--testRunnerVerbose] [-o[=<output>]]
[-c=<classpath>] [-f=<spectrumFormula>]
[--jacocoClasspath=<customJacocoClasspath>]
[--junitClasspath=<customJUnitClasspath>]
[--mavenHome=<mavenHome>] [-p=<projectPath>]
[--testRunnerJVMArgs=<testRunnerJVMArgs>]
[--testRunnerTimeoutInMs=<testRunnerTimeoutInMs>]
[-w=<workspace>] [[--format=<format>] |
--formatter=<customExporter>]
Flacoco: fault localization
-c, --classpath=<classpath>
Classpath of the project under analyzis.
--coverTest Indicates if coverage must also cover the tests.
-f, --formula=<spectrumFormula>
Spectrum formula to use. Valid values: OCHIAI
--format=<format> Format of the output. Valid values: CSV, JSON
--formatter=<customExporter>
Path to java file of a custom FlacocoExporter.
-h, --help Show this help message and exit.
--jacocoClasspath=<customJacocoClasspath>
Classpath to jacoco dependencies.
--junitClasspath=<customJUnitClasspath>
Classpath to junit dependencies.
--mavenHome=<mavenHome>
Path to maven home.
-o, --output[=<output>] Path to the output file. If no path is provided but
the flag is, the result will be stored in
flacoco_result.{extension}
-p, --projectpath=<projectPath>
Path to the project to analyze.
--testRunnerJVMArgs=<testRunnerJVMArgs>
JVM args for test-runner's test execution VMs.
--testRunnerTimeoutInMs=<testRunnerTimeoutInMs>
Timeout for each test execution with test-runner.
--testRunnerVerbose Test-runner verbose mode.
-v Verbose mode.
-V, --version Print version information and exit.
-w, --workspace=<workspace>
Path to the workspace directory of flacoco.
If the exporting options do not fit your needs, you can write your own FlacocoExporter
and pass it to flacoco
in runtime.
For example, below, we have implemented OneLineExporter
, a FlacocoExporter
implementation that writes the results all in one line:
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Map;
public class OneLineExporter implements fr.spoonlabs.flacoco.cli.export.FlacocoExporter {
@Override
public void export(Map<String, Double> results, OutputStreamWriter outputStream) throws IOException {
for (Map.Entry<String, Double> entry : results.entrySet()) {
outputStream.write(entry.getKey() + "," + entry.getValue());
}
}
}
To use this formatter in runtime, we can simply provide the path to the .java
file to flacoco
:
java -jar target/flacoco-0.0.1-SNAPSHOT-jar-with-dependencies.jar -p "examples/exampleFL1/FLtest1/" --formatter "src/test/resources/OneLineExporter.java"