1

I have two separate projects, Product and CompoTestProduct. Product is written in Scala and uses sbt while CompoTestProduct is written in Java and uses maven. Product will be deployed in a server and CompoTestProduct's tests classes will be ran locally. I tried to use scoverage as it says that it supports Multi project reports but I still have no idea how to do this and I'm still struggling to make the samples work. I am getting this error on the sample projects:

[error] Not a valid command: coverage
[error] Not a valid project ID: coverage
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: coverage (similar: homepage, package, compilerCache)
[error] coverage
[error]         ^

I am new to this code coverage testing thing. Do you have other tutorials or maybe know other framework/toolkit that can generate test code coverage report for do this setup?

Rado Buransky
  • 3,252
  • 18
  • 25
Frank Smith
  • 1,717
  • 4
  • 18
  • 32

1 Answers1

-1

The multi project support refers to being able to aggregate the results of multiple reports.

Scoverage instruments your code when you activate coverage on the sbt command line. So sbt clean coverage compile would be enough in your Product project to get the classfiles instrumented.

Then you could run your unit tests as normal with Maven. At this point Maven needs to be configured to also use Scoverage, as it will need to write out the coverage data once it is completed.

Then you would need to run the report step after.

So, summary, it is possible, with a LOT of hassle, but why are you going through these hoops to have an awkward project setup? Just move your tests into the main project, do a combined java/scala compile and it should be much easier as you could run the entire build via sbt or maven, and not both mixed.

sksamuel
  • 16,154
  • 8
  • 60
  • 108