📜 ⬆️ ⬇️

Saga: check the code coverage tests

If you write to javascript and cover the code with unit tests, then it is likely that you will be interested in how well it is covered. And if the project uses Maven, then I want to receive this information at each assembly.

So, Saga is a good code coverage analyzer:



')

What you need to start

It is assumed that you already have tests and some html-files to run them (TestRunner).
If not, I advise you to look at the Jasmine framework.


Console version

A fresh build with all dependencies can be found at code.google.com or compiled from sources on github.com . And run from the project folder, like this:

java -jar saga-cli-1.0.5-jar-with-dependencies.jar -b tests/ -o coverage/ -i **/*Test*.html 

The purpose of these and other keys can be found in the documentation .


Maven-plugin

To connect Saga, it is enough to add the following code to pom.xml:

 <plugin> <groupId>com.github.timurstrekalov</groupId> <artifactId>saga-maven-plugin</artifactId> <version>1.0.5</version> <executions> <execution> <phase>verify</phase> <goals> <goal>coverage</goal> </goals> </execution> </executions> <configuration> <baseDir>${testsBaseDir}</baseDir> <includes> **/*Test*.html </includes> <outputDir>${project.build.directory}/coverage</outputDir> </configuration> </plugin> 

The plugin will be downloaded from the central Maven repository.
More information about configuration options can be found in the documentation .


Future of the project

Developer Timur Strekalov is open to suggestions and is ready to make improvements. Already several users have left reviews, thanks to which several bugs were fixed. You can write on the project page on GitHub .

Source: https://habr.com/ru/post/143172/


All Articles