-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
Milestone
Description
TestNG Version
v7.8.0
Expected behavior
When a configuration method (method decorated with @BeforeMethod
) fails. The method decorated with @AfterMehtod(alwayRun=true)
recives an ITestResult object with status SKIPPED
(3) and the information about the configuration methods that failed.
Actual behavior
When a configuration method (method decorated with @BeforeMethod
) fails. The method decorated with @AfterMehtod(alwayRun=true)
recives an ITestResult object with status CREATED
(-1) and no information about the skip reason.
Is the issue reproducible on runner?
- Shell
- Maven
- Gradle
- Ant
- Eclipse
- IntelliJ
- NetBeans
Test case sample
package playground;
import static org.testng.Assert.assertTrue;
import org.testng.ITestResult;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class BugTest {
@BeforeMethod
public void beforeMethod() {
throw new RuntimeException("Exception to simulate configuration error");
}
@Test
public void test() {
assertTrue(true);
}
@AfterMethod(alwaysRun = true)
public void afterMethod(ITestResult testResult) {
System.out.println(testResult.getStatus()); // -1
}
}