简体   繁体   中英

running all test suites of a project written in Scala with coverage in Intellij

Is there a way to run all test suites of a project written in Scala with coverage in Intellij. Also if possible select only select specific test suites of project and run with coverage? How about the current capabilities for the same for the Java projects?

I think it might depend on what package you use to test. However if you use scalatest you can right-click on any package and select run tests which will run only the ones in that package.

Alternatively you can define a ScalaTest run configuration and choose tests by

  • All in package
  • Class
  • Test name

With test name you can pick from across multiple packages (although I've never had a use for this).

Add following line to your build.sbt file:

coverageEnabled := true

This configuration can be further refined eg

coverageEnabled in Test := true

And then right-click on the base package -> 'Run Scala Tests in 'xx'' with Coverage, should do it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM