Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Times reported in XML for testcases are wrong #731

Closed
avdv opened this issue Mar 5, 2019 · 11 comments
Closed

Times reported in XML for testcases are wrong #731

avdv opened this issue Mar 5, 2019 · 11 comments

Comments

@avdv
Copy link

avdv commented Mar 5, 2019

I am using specs2 version 4.4.1.

When running with showtimes the printed times are OK:

[info] ConvertControllerSpec
[info] ConvertController should
[info]   + convert a given Story to JSON API (340 ms)
[info]   + convert a given Story with story content to JSON API (249 ms)
[info]   + convert a given Story with several tags to JSON API (250 ms)
[info]   + convert an Image-Gallery Asset to JSON API (203 ms)
[info]   + convert a given Video Channel to JSON API (209 ms)
...
[info] Total for specification ConvertControllerSpec
[info] Finished in 12 seconds, 154 ms
[info] 47 examples, 0 failure, 0 error

But looking at the test-report in target/test-reports/controllers.ConvertControllerSpec.xml the times are totally off:

<testcase name="ConvertController should::convert a given Story to JSON API" classname="controllers.ConvertControllerSpec"
   time="8.757" />
<testcase name="ConvertController should::convert a given Story with story content to JSON API" classname="controllers.ConvertControllerSpec"
   time="8.401" />
<testcase name="ConvertController should::convert a given Story with several tags to JSON API" classname="controllers.ConvertControllerSpec"
   time="8.138" />
<testcase name="ConvertController should::convert an Image-Gallery Asset to JSON API" classname="controllers.ConvertControllerSpec"
   time="6.960" />
<testcase name="ConvertController should::convert a given Video Channel to JSON API" classname="controllers.ConvertControllerSpec"
   time="6.299" />

In reference to #613, I am not using sequential.

@avdv
Copy link
Author

avdv commented Mar 5, 2019

I had a quick look, attaching a debugger. The problem seems to be that the timers at https://github.com/etorreborre/specs2/blob/master/junit/shared/src/main/scala/org/specs2/reporter/JUnitXmlPrinter.scala#L45 are still running (timer.isStarted is true).

@etorreborre
Copy link
Owner

Thanks for having a look. The way the times were taken was quite wrong. I have a fix for it, wait a bit and a new version will be published later on today.

@avdv
Copy link
Author

avdv commented Mar 5, 2019

Awesome! Thank you Eric. 💯

@avdv
Copy link
Author

avdv commented Mar 5, 2019

BTW, while you're at it, I noticed the scaladoc for HmsTimer.stop is wrong too. It does not return a String at all.

@etorreborre
Copy link
Owner

Thanks I will change that too (and put a return type, I didn't use to do that when I started Scala!). Also you might have to be a bit patient. There's a failing spec that I need to investigate after this change.

@avdv
Copy link
Author

avdv commented Mar 5, 2019

Also you might have to be a bit patient. There's a failing spec that I need to investigate after this change.

No problem, it's not a big deal really. I just recently noticed CircleCI reported the slowest test alone took 33 seconds which piqued my interest. Historically, the test reports on our old Jenkins instance also reported such long runtimes, but nobody noticed until now.

@avdv
Copy link
Author

avdv commented Mar 11, 2019

FYI, I did just try version 4.5.0; looks good to me. 👍

@etorreborre
Copy link
Owner

Thanks for the feedback. I'm going to publish a 4.5.1 though because I think I broke a piece of some exotic functionality (random execution of examples).

@avdv
Copy link
Author

avdv commented Mar 11, 2019

OK, I'm holding my breath until the official announcement anyway... 😉

@etorreborre
Copy link
Owner

OK, just announced it: https://twitter.com/specs2org/status/1105071256112631809

@avdv
Copy link
Author

avdv commented Mar 11, 2019

Thank you! 💐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants