Skip to content
Kaj Dreef edited this page Apr 9, 2020 · 9 revisions

Tacoco

Welcome to the tacoco wiki!

Compiling Tacoco

  1. Install Primitive Hamcrest (https://github.com/spideruci/primitive-hamcrest) in your local repository (check instruction in given in primitive-hamcrest's Readme.md).
  2. Run mvn compile as a sanity check to make sure that there are no compile-time errors.
  3. Run mvn test to make sure that tacoco is working against its own test-cases.

If you want to run the integration tests or run mvn install, make sure to update your maven settings.xml (typically located at $HOME/.m2/settings.xml) to allow for pulling maven packages from github packages, see here and here for more info.

Analyzing with Tacoco

  • Get fresh tacoco
  git clone https://github.com/spideruci/tacoco
  mvn compile
  • Run tacoco
mvn -q exec:java -Plauncher -Dtacoco.sut=/abolute/path/of/target/root
  • Run tacoco and produce sqlite3 database file
mvn -q exec:java -Plauncher -Dtacoco.sut=/abolute/path/of/target/root -Dtacoco.db
  • Alternatively use the export-sut-cp to Run tacoco
## make sure that you run `mvn test` on your project
cd /to/your/project/root
mvn test
## switch to tacoco and run export-sut-cp
cd /to/tacoco/project/root
cd scripts
chmod +x export-sut-cp # you need to do this just once.
./export-sut-cp absolute/path/of/your/project/root absolute/path/of/tacoco/root
## this should create a jacoco.exec file in the `absolute/path/of/tacoco/root`

Tacoco (Launcher)

tacoco$ mvn -q exec:java -Plauncher -Dtacoco.help

Tacoco: Launcher
usage: mvn exec:java -q -Plauncher [arguments]

Arguments:
-Dtacoco.sut=<dir>              (Required) Absolute-path of system-
                                under-test's root.
-Danalyzer.opts                 (Required) Specify configuration file which holds jvm and tacoco options 
-Dtacoco.listeners=             Test listeners which implements ITacocoTestListener
-Dtacoco.analyzer=              Analyzer classes which implements AbstractAnalyzer or AbstractRuntimeAnalyzer
-Dtacoco.home=<dir>		(Defalult: current dir) Tacoco's Home dir
-Dtacoco.project=<string>	(Default: ID from sut's build system)
				MAVEN: GroupID.ArtifactID
				All Tacoco's output files(exec, db, log, err)-
				use this for prefix.
-Dtacoco.thread=<number>	(Default: 1) Number of JUnit Runner Thread
-Dtacoco.log=<on/off>		(Default: off) Print Detailed Logs
-Dtacoco.outdir=<dir>		(Default: tacoco.home/tacoco_out)
-Dtacoco.db			Dump exec output to sqlite3 db file
-Dtacoco.help			Prints this message and exits (with 0)