Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Measure Scala Code coverage in testcases in Eclipse

I am in a situation, where I have a number of ScalaTest written tests (JUnit compatible), and I want to measure how good codecoverage I get, when running the test.

I don't want to use SBT directly, but have an Eclipse Scala project, in which I have a number of test cases that I want to run.

What would be the best way for me to go?

like image 616
StefanE Avatar asked Dec 11 '11 12:12

StefanE


People also ask

How do I get STS coverage?

Right-click on project > Properties > Coverage to enable code coverage. Then, right-click on project > Run Code Coverage.


1 Answers

I use EclEmma for code coverage in Eclipse. Install it using the update site.

Note that it's won't show up in the Scala perspective, only the Java perspective, but that's ok because you can still run your Scala-based unit tests that way.

When you install it, it adds a new "run" button to your toolbar. When you use this is runs the unit tests you choose, generates a coverage report, and highlights your code to show what has and has not been covered.

I just tested it with a Scala project with Scala unit tests, and it seems to work fine.

like image 155
dhg Avatar answered Sep 28 '22 01:09

dhg