Description
openedon Jun 6, 2018
Overview
I need to handle exceptions thrown during the execution of each @BeforeAll
, @AfterAll
, @BeforeEach
, and @AfterEach
method.
There are test lifecycle callbacks. Just for error tracking needs these callbacks are useful, but if I need to capture AUT (application under test) state (for example to take an application screenshot, log current condition) at exception time, then these callbacks are not enough, because application state is changed before execution reaches the callback.
Let's say an exception occurs in a @BeforeEach
method. I need to take an application screenshot at this exception. The nearest callback to handle the exception is AfterEachCallback
. So application state is changed in @AfterEach
method, and we lose original screen of application in AfterEachCallback
. I reference to the diagram here.
Proposal
Introduce the following additional callback extension APIs which will be invoked after each @BeforeAll
, @AfterAll
, @BeforeEach
and @AfterEach
method. This make it possible to handle exceptions and take application screenshots at the correct point in time.
AfterBeforeAllCallack
AfterAfterAllCallback
AfterBeforeEachCallback
AfterAfterEachCallback