Skip to content
André Silva edited this page Jun 29, 2021 · 17 revisions

Getting Started

Welcome to the flacoco wiki!

flacoco is a fault localization tool for Java based on Jacoco and test-runner that aims at encompassing several fault localization techniques.

Installation

flacoco is currently only available as a SNAPSHOT.

You can use it by installing locally yourself, or by adding flacoco as a maven dependency:

$ mvn install
<dependency>
  <groupId>com.github.spoonlabs</groupId>
  <artifactId>flacoco</artifactId>
  <version>0.0.1-SNAPSHOT</version>
</dependency>

Usage

flacoco can currently be used through the API or the command line interface.

Usage through the API

The following example illustrates a common usage of the flacoco API, where we run flacoco on a test project using spectrum-based fault localization with the Ochiai formula. As a result, we obtain a mapping between suspicious lines and suspiciousness scores.

Example usage:

Flacoco flacoco = new Flacoco();
FlacocoConfig config = FlacocoConfig.getInstance();

config.setProjectPath("./examples/exampleFL1/FLtest1");
config.setClasspath(classpath);
config.setFamily(FlacocoConfig.FaultLocalizationFamily.SPECTRUM_BASED);
config.setSpectrumFormula(SpectrumFormula.OCHIAI);

Map<String, Double> susp = flacoco.runDefault();

Full reference can be found under API.

Usage through the CLI

Currently, there are two ways of using the flacoco cli. The following examples illustrate the aforementioned example:

java -cp 'target/flacoco-0.0.1-SNAPSHOT-jar-with-dependencies.jar' fr.spoonlabs.flacoco.FlacocoMain --projectpath examples/exampleFL1/FLtest1/
java -jar target/flacoco-0.0.1-SNAPSHOT-jar-with-dependencies.jar --projectpath examples/exampleFL1/FLtest1/

Full reference can be found under CLI.

Clone this wiki locally