9

How to get a list of test cases (fully qualified names) under current project?

The environment is Scala 2.10.2, Sbt 0.12.3 and scalatest 1.9.1

1 Answer 1

11

(definedTests in Test) returns sbt.TestDefinition.

val printTests = taskKey[Unit]("something")

printTests := {
  val tests = (definedTests in Test).value
  tests map { t =>
    println(t.name)
  }
}

The above is in sbt 0.13 syntax, but the idea should be same in sbt 0.12.

1
  • 3
    Thanks for the answer but I am not sure how to use it. Can I use this from the SBT command prompt or does it need to be in a configuration file? Personally, I would like the former. Jun 18, 2018 at 2:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.