depends on attribute for classes

16 views
Skip to first unread message

SPS

unread,
Sep 21, 2016, 12:39:58 PM9/21/16
to testng-users
Hello,

I have two tests A and B in my tesng.xml. I would like to test B only if test A passes. Is there a way to handle this situation?

<suite >
   <test name = "A">
             <class name = "c1">
   </test>

 <test name = "B">
             <class name = "c2">
  </test>


</suite>


Thanks

⇜Krishnan Mahadevan⇝

unread,
Sep 25, 2016, 12:08:36 PM9/25/16
to testng...@googlegroups.com
Sneha,

You can try doing the following :
  1. Make sure you disable parallel execution [ That is critical to your requirement ]
  2. Built a listener which implements org.testng.ITestListener wherein within org.testng.ITestListener#onStart you check for a boolean that indicates failures.
  3. Within org.testng.ITestListener#onFinish you check to see if there are any failed methods and set a boolean variable [ which is what is read by (2) ]




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 Scribbings @ http://rationaleemotions.wordpress.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+unsubscribe@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages