27

We use ScalaTest to run tests and display the results in Jenkins. It works great, but for some reason ScalaTest` does not populate the test runtime.

I'm adding test options like this:

    Tests.Argument("-oD", "-u", "target/test-reports")

But the XML file does not have timings (see time is always 0):

<testcase classname="beekeeper.warehouse.jdbc.JDBCWarehouseTest" name="testListTables" time="0.0">
</testcase>
<testcase classname="beekeeper.warehouse.jdbc.JDBCWarehouseTest" name="testGetDatabases" time="0.0">
</testcase>
<testcase classname="beekeeper.warehouse.jdbc.JDBCWarehouseTest" name="testSchema" time="0.0">
</testcase>

Do I need to do something else to have it report this, or is it not supported?

Tomer Shetah
  • 8,413
  • 7
  • 27
  • 35
Matthew Rathbone
  • 8,144
  • 7
  • 49
  • 79
  • What build configuration tool do you use? `sbt`? Can you run tests from command line and reproduce the issue? If so what, please paste the command you use? – Jakozaur May 01 '15 at 11:52
  • If you can give more detail that would help. For instance, are you adding `Tests.Argument` to `testOptions in Test`? I think it won't work just adding to `testOptions`. – Dale Wijnand May 02 '15 at 16:30
  • Yes, I'm adding testOptions in Test - – Matthew Rathbone May 07 '15 at 16:03
  • testOptions in Test := Seq( Tests.Filter(unitFilter), Tests.Argument(TestFrameworks.ScalaTest, "-oD"), Tests.Argument(TestFrameworks.ScalaTest, "-u", "target/test-reports") ), – Matthew Rathbone May 07 '15 at 16:03
  • Can you please tell us which versions are you using? scala, sbt, scalatest. Are you using any framework such as play, or others? Are you sure it is constantly zero? can you try to add a sleep into the test to see if it is still sero? – Tomer Shetah Jul 29 '20 at 05:42

1 Answers1

1

I can't reproduce this issue. Using sbt 1.1.6 and ScalaTest 3.0.5 I see non-zero time field:

<testcase classname="example.HelloSpec" name="The Hello object should say hello" time="0.016">
Eugene Yokota
  • 94,654
  • 45
  • 215
  • 319