简体   繁体   中英

Running scalatest classes from sbt file

I am running my test class from sbt file using task

scalaTaskRun := {
  val test = (runMain in Compile).fullInput(" org.scalatest.tools.Runner -s package.tests.TestClass1 -h ReportOutput").evaluated
}

to get a html report output for single test class. But I don't want to add -s TestClass2 again for running one more tests and so on...

If I want to run many test classes from sbt file just like running testNG suite xml which contains more than one test classes. How can the same thing be achieved in sbt scalatest??

I tried running with the runpath command...

Runner -R target\\\\folder\\\\classes -w package.testcases -h reportFolder

But it's not running the compiled test classes from classes folder.

Kindly help in fixing it.

You can tell sbt which tests you want to run:

testOnly package.testcases.* -- -h reportFolder

everything after -- gets passed through to the test framework (eg ScalaTest).

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