Like we have a test report containing information like
<testcase classname="ABC" name="should fulfill some condition" time="12.22">
How can I get this information in another test class? For example, Suppose we have a Test Class One which has some tests implemented using Scala Test. How can get the list of all tests with description implemented in Class One in another test class Two?
You can call testNames
to get a set of all tests.
scala> class FooSpec extends AnyFlatSpec {
| "foo" should "do thing" in { }
| it should "do something else" in { }
| }
class FooSpec
scala> new FooSpec().testNames
val res1: Set[String] = TreeSet(foo should do thing, foo should do something else)