testng: @AfterMethod(alwaysRun = true) is not getting called if we have exception in @BeforeMethod

TestNG Version

6.11

Expected behavior

@afterMethod is not called if test is throwing exception in @beforeMethod.

Actual behavior

@afterMethod should be called if test is throwing exception in @beforeMethod.

Is the issue reproductible on runner?

  • Shell
  • Maven
  • Gradle
  • Ant
  • Eclipse
  • IntelliJ
  • NetBeans

Test case sample

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Cédric has some issues with maven central and you can follow #1506