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?
Right-click on project > Properties > Coverage to enable code coverage. Then, right-click on project > Run Code Coverage.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With