Skip to content

codevineyard/sbt-coverage-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SBT Coverage Example

Running

sbt clean coverage test coverageReport

passes with 100% coverage even though DoubleSpec is commented out.

The problem

How can the project be changed so that MainSpec does not affect coverage, while DoubleSpec does?

Solution 1

Use a combination of test tags and a multi-part sbt script. Each time sbt starts, coverage is off. Run

./runtests.sh

Solution 2

Instead of the run script, add a new command testWithSmartCoverage to build.sbt. Run

sbt testWithSmartCoverage

Solution 3

A more complex terminal command with coverageOff in the middle:

sbt clean coverage "testOnly * -- -l ExcludeFromCoverage" coverageOff "testOnly * -- -n ExcludeFromCoverage" coverageReport

Kudos to Mario Galic for amazing help on Stackoverflow!

About

Researching whether coverage can be excluded on some tests

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors