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
We use @Order to define user stories so that each test in a class accomplishes a validation and strictly depends on previous ones and is required by the following ones.
Currently @Order in case of error continues executing the following tests in the class which causes other tests to fail consuming resources and polluting test reports.
I'd be useful to have a fail-fast configuration so that on a failure no more tests are executed.
This would be specially helpful in convination of Test Retry Gradle plugin with new classRetry feature.
Example:
Currently:
on a class with tests 1, 2 and 3. If two fails we see 1, 2 and 3 run, with 2 and 3 failing.
We'd expect that:
on a class with tests 1, 2 and 3. If two fails we see 1, 2, with 2 failing. 3 should be ignored or marked as skipped.
The text was updated successfully, but these errors were encountered:
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@TestMethodOrder(OrderAnnotation.class)
@ExtendWith(SkipRemainingOnFailure.Extension.class)
@interface SkipRemainingOnFailure {
classExtensionimplementsTestWatcher, ExecutionCondition {
staticfinalNamespaceNAMESPACE = Namespace.create(Extension.class);
@OverridepublicvoidtestFailed(ExtensionContextcontext, Throwablecause) {
// Store in extension context of parent (i.e. test class) so that subsequent test can see failurecontext.getParent()
.orElseThrow(() -> newRuntimeException("test without parent"))
.getStore(NAMESPACE)
.put("failed", true);
}
@OverridepublicConditionEvaluationResultevaluateExecutionCondition(ExtensionContextcontext) {
returncontext.getStore(NAMESPACE).getOrDefault("failed", Boolean.class, false)
? ConditionEvaluationResult.disabled("Skipping due to prior failure")
: ConditionEvaluationResult.enabled("No prior failure");
}
}
}
We use
@Order
to define user stories so that each test in a class accomplishes a validation and strictly depends on previous ones and is required by the following ones.Currently
@Order
in case of error continues executing the following tests in the class which causes other tests to fail consuming resources and polluting test reports.I'd be useful to have a fail-fast configuration so that on a failure no more tests are executed.
This would be specially helpful in convination of Test Retry Gradle plugin with new
classRetry
feature.Example:
Currently:
on a class with tests 1, 2 and 3. If two fails we see 1, 2 and 3 run, with 2 and 3 failing.
We'd expect that:
on a class with tests 1, 2 and 3. If two fails we see 1, 2, with 2 failing. 3 should be ignored or marked as skipped.
The text was updated successfully, but these errors were encountered: