Search code examples
scalamicroservicesakka-http

how can i run my scala code coverage fully


my scala code coverage report was 0.00% (Akka-HTTP microservices) and my report is

[info] Statement coverage.: 0.00%
[info] Branch coverage....: 0.00%
[info] Coverage reports completed
[info] All done. Coverage was [0.00%]

how can i run the my code coverage report 100%

am using this plugin addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1") and in my code i don't have any unit test cases


Solution

  • Code coverage measures how much of your code is exercised by unit tests. You can't get 100% coverage without writing unit tests. Your question therefore reduces to "how do I add unit tests to scala code".

    The simplest answer to this is to choose a unit test framework (of which there are a few). I tend to use http://www.scalatest.org/, which is reasonably well documented, and you can follow its user guide for info on how to structure tests and so forth.