0

I have a batch job developed in scala. I am triggering the job with a shell script and would like to measure the code coverage for the job. The job is triggered after build creation.

How to the start scoverage after this job?

Roman Pokrovskij
  • 9,449
  • 21
  • 87
  • 142
sri_ae
  • 3
  • 2
  • You may use **Scoverage**, link to the maven plugin: https://github.com/scoverage/scoverage-maven-plugin – Luis Miguel Mejía Suárez Dec 08 '18 at 14:41
  • Actually its not part of the build process, rather running the job after the build created. I am using scoverage for unittests, but not sure how to instrument the coverage while running the scala jobs outside build process. – sri_ae Dec 08 '18 at 17:45
  • you mean some kind of integration testing? - I'm not an expert in testing, but I don't think you should measure code coverage on those, for example look at this: https://sqa.stackexchange.com/questions/24997/why-do-code-coverage-of-integration-test – Luis Miguel Mejía Suárez Dec 08 '18 at 20:07
  • Can you prepare simple example project similar to yours? It will be a lot easier to understand your setup with it. – Grzegorz Slowikowski Dec 27 '18 at 18:59

1 Answers1

-1

You can add below command in shell script to execute test and measure coverage:

sbt clean coverage test coverageReport

You can add below command to check if coverage is above minimum in build.sbt:

coverageMinimum := 80
coverageFailOnMinimum := true
mukesh210
  • 2,792
  • 2
  • 19
  • 41
  • Hi Mukesh, Thanks for your reply. Below are the steps i am following as of now: 1. Build application using maven. 2. Shell scripts are generated in target folder. 3. I am triggering the shell scripts to invoke scala jobs. Here my project is based on maven and also i dont have any clue on generating the coverage on job executions like these. – sri_ae Dec 08 '18 at 09:55