From a114bb111b97a155c3dfa69ee57dfa1ba186353c Mon Sep 17 00:00:00 2001 From: wlopper <1938789025@qq.com> Date: Wed, 1 Feb 2023 18:12:01 +0800 Subject: [PATCH] Update TestNGTestUnit.java @AfterXXX method not skip --- src/main/java/org/pitest/testng/TestNGTestUnit.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/pitest/testng/TestNGTestUnit.java b/src/main/java/org/pitest/testng/TestNGTestUnit.java index 23bd084..17f05c3 100644 --- a/src/main/java/org/pitest/testng/TestNGTestUnit.java +++ b/src/main/java/org/pitest/testng/TestNGTestUnit.java @@ -135,10 +135,20 @@ class FailFast implements IInvokedMethodListener { @Override public void beforeInvocation(IInvokedMethod method, ITestResult testResult) { - if (this.listener.hasHadFailure()) { + if (this.listener.hasHadFailure() && notAfterConfiguration(method)) { throw new SkipException("Skipping"); } } + + private boolean notAfterConfiguration(IInvokedMethod method) { + ITestNGMethod testMethod = method.getTestMethod(); + boolean flag = testMethod.isAfterClassConfiguration() + || testMethod.isAfterMethodConfiguration() + || testMethod.isAfterGroupsConfiguration() + || testMethod.isAfterSuiteConfiguration() + || testMethod.isAfterTestConfiguration(); + return !flag; + } @Override public void afterInvocation(IInvokedMethod method, ITestResult testResult) {