Best way to capture test start time in output?

9 views
Skip to first unread message

Brian Hartin

unread,
Aug 24, 2017, 4:16:45 PM8/24/17
to specs2-users
Hello,

I'm trying to capture the start/end time in the output of my specs.  I'm running them via SBT and using Specs2 3.8.9.

I tried to do it with a custom Notifier, which did work, but it replaces the normal output which was undesirable.  I'd like to extend the SBT notifier behavior, but it's an anonymous Notifier buried in the SBTPrinter, so I'd have to copy a lot of code.  I suspect there's a simpler way but I haven't seen it yet.

The statistics files in /target/specs2-reports are almost what I need, but they lack start time and I see no way to extend them.

I've considered handling it outside of specs, via linux pipes and `ts`, but I'd rather just enhance the existing output if possible.

Thanks!

Brian

etorreborre

unread,
Aug 25, 2017, 12:39:12 AM8/25/17
to specs2-users
Hi Brian,

By "replaces the normal output" you mean "removes it"?

In that case this is because when you add a custom notifier you "reset" the list of printers to just that notifier 
precisely for the case where you don't want other outputs. You can put the console printing back by
adding the "console" argument to the command line:

sbt> testOnly *BinarySpec* -- notifier org.acme.reporting.TimesNotifier console

I hope that helps

Brian Hartin

unread,
Aug 27, 2017, 8:51:02 PM8/27/17
to specs2-users
Yes, I think that will work.  Thank you!
Reply all
Reply to author
Forward
0 new messages