New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
dipak-pawar opened this Issue May 8, 2017 · 15 comments

Comments

Projects
None yet
4 participants
@dipak-pawar
Contributor

dipak-pawar commented May 8, 2017

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

dipak-pawar added a commit to dipak-pawar/testng that referenced this issue May 8, 2017

fixes cbeust#1426 @afterMethod should be called if @beforeMethod thro…
…ws exeption with configfailurepolicy as continue.

dipak-pawar added a commit to dipak-pawar/testng that referenced this issue May 8, 2017

fixes cbeust#1426 @afterMethod should be called if @beforeMethod thro…
…ws exeption with configfailurepolicy as continue.
@juherr

This comment has been minimized.

Show comment
Hide comment
@juherr

juherr May 8, 2017

Collaborator

IMO it is not an issue: according to the documentation, you have to set alwaysRun = true on the @AfterMethod.

alwaysRun: For after methods (afterSuite, afterClass, ...): If set to true, this configuration method will be run even if one or more methods invoked previously failed or was skipped.

@cbeust WDYT?

Collaborator

juherr commented May 8, 2017

IMO it is not an issue: according to the documentation, you have to set alwaysRun = true on the @AfterMethod.

alwaysRun: For after methods (afterSuite, afterClass, ...): If set to true, this configuration method will be run even if one or more methods invoked previously failed or was skipped.

@cbeust WDYT?

@cbeust

This comment has been minimized.

Show comment
Hide comment
@cbeust

cbeust May 8, 2017

Owner

@juherr Agreed, not an issue.

Owner

cbeust commented May 8, 2017

@juherr Agreed, not an issue.

@cbeust cbeust closed this May 8, 2017

@juherr

This comment has been minimized.

Show comment
Hide comment
@juherr

juherr May 8, 2017

Collaborator

But at the same time:

configfailurepolicy: Whether TestNG should continue to execute the remaining tests in the suite or skip them if an @before* method fails. Default behavior is skip.

BTW, @AfterMethod is not a test method but a configuration one.

Collaborator

juherr commented May 8, 2017

But at the same time:

configfailurepolicy: Whether TestNG should continue to execute the remaining tests in the suite or skip them if an @before* method fails. Default behavior is skip.

BTW, @AfterMethod is not a test method but a configuration one.

@dipak-pawar dipak-pawar changed the title from @afterMethod is not getting called if we have exception in @beforeMethod with configfailurepolicy as continue to @AfterMethod(alwaysRun = true) is not getting called if we have exception in @beforeMethod, running test with configfailurepolicy as continue. May 9, 2017

@dipak-pawar dipak-pawar changed the title from @AfterMethod(alwaysRun = true) is not getting called if we have exception in @beforeMethod, running test with configfailurepolicy as continue. to @AfterMethod(alwaysRun = true) is not getting called if we have exception in @beforeMethod and we are running test with configfailurepolicy as continue. May 9, 2017

dipak-pawar added a commit to dipak-pawar/testng that referenced this issue May 9, 2017

fixes cbeust#1426 if @BeforeMethod throws exception
* @AfterMethod should be called with configfailurepolicy as continue.
* @AfterMethod(alwaysRun = true) should be called with configfailurepolicy as default i.e. skipped.

@dipak-pawar dipak-pawar changed the title from @AfterMethod(alwaysRun = true) is not getting called if we have exception in @beforeMethod and we are running test with configfailurepolicy as continue. to @AfterMethod(alwaysRun = true) is not getting called if we have exception in @BeforeMethod May 9, 2017

dipak-pawar added a commit to dipak-pawar/testng that referenced this issue May 9, 2017

dipak-pawar added a commit to dipak-pawar/testng that referenced this issue May 9, 2017

@dipak-pawar

This comment has been minimized.

Show comment
Hide comment
@dipak-pawar

dipak-pawar May 9, 2017

Contributor

@juherr @cbeust

IMO it is not an issue: according to the documentation, you have to set alwaysRun = true on the @AfterMethod.

I have added tests in #1432 for this issue which should be failed as this is bug in current version of testng.

Could you please look into it? Once you confirmed it. I'll provide fix for it.

Contributor

dipak-pawar commented May 9, 2017

@juherr @cbeust

IMO it is not an issue: according to the documentation, you have to set alwaysRun = true on the @AfterMethod.

I have added tests in #1432 for this issue which should be failed as this is bug in current version of testng.

Could you please look into it? Once you confirmed it. I'll provide fix for it.

@juherr

This comment has been minimized.

Show comment
Hide comment
@juherr

juherr May 10, 2017

Collaborator

I reopen because #1432 is showing the issue.

@dipak-pawar Thanks for the test case and the effort :)

Collaborator

juherr commented May 10, 2017

I reopen because #1432 is showing the issue.

@dipak-pawar Thanks for the test case and the effort :)

@juherr juherr reopened this May 10, 2017

dipak-pawar added a commit to dipak-pawar/testng that referenced this issue May 10, 2017

* Added fix for cbeust#1426
* More tests around it
@dipak-pawar

This comment has been minimized.

Show comment
Hide comment
@dipak-pawar

dipak-pawar May 10, 2017

Contributor

@juherr Thank you for reopening this issue. I have provided fix in #1432. So tests should be passing now. Please have a look into it.

Contributor

dipak-pawar commented May 10, 2017

@juherr Thank you for reopening this issue. I have provided fix in #1432. So tests should be passing now. Please have a look into it.

dipak-pawar added a commit to dipak-pawar/testng that referenced this issue May 10, 2017

* Added fix for cbeust#1426
* More tests around it
@juherr

This comment has been minimized.

Show comment
Hide comment
@juherr

juherr May 10, 2017

Collaborator

Fixed by #1432

Collaborator

juherr commented May 10, 2017

Fixed by #1432

@juherr juherr closed this May 10, 2017

@dipak-pawar

This comment has been minimized.

Show comment
Hide comment
@dipak-pawar

dipak-pawar May 11, 2017

Contributor

@juherr Do you have any idea when do we get new release of testng?

Contributor

dipak-pawar commented May 11, 2017

@juherr Do you have any idea when do we get new release of testng?

@bartoszmajsak

This comment has been minimized.

Show comment
Hide comment
@bartoszmajsak

bartoszmajsak Jun 12, 2017

@juherr @cbeust Just wondering what are the plans for the next release, as without this fix we are not able to run TestNG tests (newer than 6.8.21) in Arquillian.

bartoszmajsak commented Jun 12, 2017

@juherr @cbeust Just wondering what are the plans for the next release, as without this fix we are not able to run TestNG tests (newer than 6.8.21) in Arquillian.

@juherr

This comment has been minimized.

Show comment
Hide comment
@juherr

juherr Jun 12, 2017

Collaborator

@bartoszmajsak There is no existing plan and the changelog looks big enough. I think @cbeust can make a release asap.

Collaborator

juherr commented Jun 12, 2017

@bartoszmajsak There is no existing plan and the changelog looks big enough. I think @cbeust can make a release asap.

@bartoszmajsak

This comment has been minimized.

Show comment
Hide comment
@bartoszmajsak

bartoszmajsak Jun 18, 2017

That would be awesome @juherr. @cbeust do you plan to make a release anytime soon?

bartoszmajsak commented Jun 18, 2017

That would be awesome @juherr. @cbeust do you plan to make a release anytime soon?

@bartoszmajsak

This comment has been minimized.

Show comment
Hide comment
@bartoszmajsak

bartoszmajsak Aug 11, 2017

Just noticed that 6.12 is out. Thanks!

@cbeust any chance of putting it on Maven Central? It's only on Bintray at this point.

bartoszmajsak commented Aug 11, 2017

Just noticed that 6.12 is out. Thanks!

@cbeust any chance of putting it on Maven Central? It's only on Bintray at this point.

@bartoszmajsak

This comment has been minimized.

Show comment
Hide comment
@bartoszmajsak

bartoszmajsak Aug 21, 2017

Sorry for being such a PITA, but can you give me some answer @cbeust @juherr? :)

bartoszmajsak commented Aug 21, 2017

Sorry for being such a PITA, but can you give me some answer @cbeust @juherr? :)

@juherr

This comment has been minimized.

Show comment
Hide comment
@juherr

juherr Aug 21, 2017

Collaborator

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

Collaborator

juherr commented Aug 21, 2017

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

@bartoszmajsak

This comment has been minimized.

Show comment
Hide comment
@bartoszmajsak

bartoszmajsak Aug 21, 2017

Thanks! Haven't noticed this issue.

bartoszmajsak commented Aug 21, 2017

Thanks! Haven't noticed this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment