how to get the test result in AfterEach

34 views
Skip to first unread message

J Knurek

unread,
Mar 24, 2015, 2:34:44 PM3/24/15
to scalate...@googlegroups.com
I've switched to using BeforeAndAfterEachTestData in order to get the test name in the afterEach() method. But is there a way to get the test result (whether it passed or failed) in the after step? 

Bill Venners

unread,
Mar 24, 2015, 3:48:59 PM3/24/15
to scalate...@googlegroups.com
Hi,

If you need the result you'll want to use withFixture instead of (or
in addition to) afterEach. The parameter to withFixture is the test
function that returns the Outcome of the test as a result. If you
still prefer to use afterEach, you can do so by overriding withFixture
and storing the Outcome of the current test in a var, which is then
accessed by afterEach.

Bill
> --
> You received this message because you are subscribed to the Google
> Groups "scalatest-users" group.
> To post to this group, send email to scalate...@googlegroups.com
> To unsubscribe from this group, send email to
> scalatest-use...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/scalatest-users?hl=en
> ScalaTest itself, and documentation, is available here:
> http://www.artima.com/scalatest
> ---
> You received this message because you are subscribed to the Google Groups
> "scalatest-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to scalatest-use...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Bill Venners
Artima, Inc.
http://www.artima.com

J Knurek

unread,
Mar 24, 2015, 6:42:53 PM3/24/15
to scalate...@googlegroups.com
neat - not the straight forward solution I had hoped for when I started, but this gives me something to work with
Reply all
Reply to author
Forward
0 new messages