configfailurepolicy="continue" works only for @BeforeTest methods

131 views
Skip to first unread message

Veena Devi

unread,
Apr 26, 2022, 7:32:32 AM4/26/22
to testng-users
When suite.xml is mentioned with configfailurepolicy="continue", the test case executes only when @BeforeTest fails.

 It's not working for other @Before**  annotations.

As per documentation is it applicable for  all @Before** methods  

Whether TestNG should continue to execute the remaining tests in the suite or skip them if an @Before* method fails. The default behavior is to skip


Here is the sample code 

Java class---

public class CheckConfigFailureTest

{
@BeforeMethod
public void chechBeforeFailure(){
System.out.println("chechBeforeClassFailure");
Assert.assertTrue(false);
}

@Test
public void doActualTest(){
System.out.println("doActualTest");
}

@Test
public void doActualTest2(){
System.out.println("doActualTest2");
}

@AfterClass
public void chechAfterMethodFailure(){
System.out.println("chechAfterConfigFailure");
Assert.assertTrue(false);
}
}

testSuite.xml 

<suite name="Suite1" configfailurepolicy="continue" verbose="1" >

<test name="Regression1" >
<classes>

<class name="test.java.my.codeSamples.CheckConfigFailureTest"></class>

</classes>

</test>

⇜Krishnan Mahadevan⇝

unread,
Apr 26, 2022, 7:58:41 AM4/26/22
to testng-users
What version of TestNG are you using? 
Please ensure that you are using TestNG 7.5 and post back the results.


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/


--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/testng-users/44da3f0f-b16a-4335-a30e-bce4cc782d96n%40googlegroups.com.

Veena Devi

unread,
Apr 26, 2022, 12:47:16 PM4/26/22
to testng-users
Yes , using testNG 7.5 

 Snip20220426_5.png

Krishnan Mahadevan

unread,
Apr 28, 2022, 10:56:31 PM4/28/22
to testng...@googlegroups.com

Veena,

 

Looks like there’s already an issue filed on this https://github.com/cbeust/testng/issues/2731 and there’s an open PR against this issue as well.

Please continue to track this discrepancy via the above mentioned issue.

 

 

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribblings @ https://rationaleemotions.com/

 

 

From: "testng...@googlegroups.com" <testng...@googlegroups.com> on behalf of Veena Devi <veena...@gmail.com>
Reply to: "testng...@googlegroups.com" <testng...@googlegroups.com>
Date: Tuesday, 26 April 2022 at 10:17 PM
To: testng-users <testng...@googlegroups.com>
Subject: Re: [testng-users] configfailurepolicy="continue" works only for @BeforeTest methods

 

Yes , using testNG 7.5 

 

 

Reply all
Reply to author
Forward
0 new messages