You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the TestWatcher to collect information for reporting the status of tests by implementing testDisabled, testSuccessful, testAborted, and testFailed. This is working fine as long as there is no failure inside a @BeforeAll or postProcessTestInstance method, in which case none of the TestWatcher methods is called, and the test is kind of lost.
To detect this state, a lot of other interfaces must be implemented, and information has to be combined. It would be better to have a complete view of the test results using only the TestWatcher.
Deliverables
TestWatcher.testSkipped(ExtensionContext context, ExtensionContext origin, Throwable reason) should be invoked for tests not executed at all
ExtensionContext origin argument with details about the failed ExtensionContext causing the test to get skipped
Throwable reason argument with details about the failure
The text was updated successfully, but these errors were encountered:
* {@code @RepeatedTest} and {@code @ParameterizedTest}). Moreover, if there is a
* failure at the class level — for example, an exception thrown by a
* {@code @BeforeAll} method — no test results will be reported. Similarly,
* if the test class is disabled via an {@link ExecutionCondition} — for
* example, {@code @Disabled} — no test results will be reported.
Have you considered registering a TestExecutionListener instead of using TestWatcher? It would receive a call to executionFinished with a failed result for the test class and you could then inspect its children via the TestPlan supplied to testPlanExecutionStarted.
@marcphilipp i am not refering to testDisabled, the feature request is about a new method testSkipped (or better testBlocked?)
The way using the TestExecutionListener is possible and this is my current workaround, adding alot of complexity.
Implementing a TestWatcher is mutch easier and should - in my mind - cover all the states of all tests, otherwise people might miss some tests and they are e.g. not included into their reporting.
sbrannen
changed the title
TestWatcher.testSkipped to collect infos about not executed tests due to failures in @BeforeAllTestWatcher.testSkipped() should be invoked for tests not executed due to failures in @BeforeAllJan 16, 2025
I am using the
TestWatcher
to collect information for reporting the status of tests by implementingtestDisabled
,testSuccessful
,testAborted
, andtestFailed
. This is working fine as long as there is no failure inside a@BeforeAll
orpostProcessTestInstance
method, in which case none of theTestWatcher
methods is called, and the test is kind of lost.To detect this state, a lot of other interfaces must be implemented, and information has to be combined. It would be better to have a complete view of the test results using only the
TestWatcher
.Deliverables
TestWatcher.testSkipped(ExtensionContext context, ExtensionContext origin, Throwable reason)
should be invoked for tests not executed at allExtensionContext origin
argument with details about the failedExtensionContext
causing the test to get skippedThrowable reason
argument with details about the failureThe text was updated successfully, but these errors were encountered: