how to stop a test suite if one method fails

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

how to stop a test suite if one method fails

Mark Waschkowski
Hi,

I've searched the forums, but couldn't find anything except old
threads that may not be applicable anymore - is there a way to cancel
all subsequent tests when one test fails?

Thank you!

Mark

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to stop a test suite if one method fails

Cédric Beust ♔-2
No, there is no such thing at the moment.

-- 
Cédric


On Mon, Apr 18, 2011 at 9:10 AM, mwaschkowski <[hidden email]> wrote:
Hi,

I've searched the forums, but couldn't find anything except old
threads that may not be applicable anymore - is there a way to cancel
all subsequent tests when one test fails?

Thank you!

Mark

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.




--
Cédric


--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to stop a test suite if one method fails

Mark Waschkowski
OK, thank you.

Mark

2011/4/18 Cédric Beust ♔ <[hidden email]>
No, there is no such thing at the moment.

-- 
Cédric


On Mon, Apr 18, 2011 at 9:10 AM, mwaschkowski <[hidden email]> wrote:
Hi,

I've searched the forums, but couldn't find anything except old
threads that may not be applicable anymore - is there a way to cancel
all subsequent tests when one test fails?

Thank you!

Mark

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.




--
Cédric


--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.



--
Mark Waschkowski
Senior Architect/Project Manager

RefinedData
174 West Beaver Creek
Richmond Hill, ON
L4B 1B4

[hidden email]
1-877-643-6439 x 789

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to stop a test suite if one method fails

CreeTar
In reply to this post by Cédric Beust ♔-2
One year has passed, is there anything implemented by now that would allow this?

Am Montag, 18. April 2011 20:41:47 UTC+2 schrieb Cedric:

> No, there is no such thing at the moment.
>
>
> -- 
> Cédric
>
>
>
>
> On Mon, Apr 18, 2011 at 9:10 AM, mwaschkowski <[hidden email]> wrote:
>
>
> Hi,
>
>
>
> I've searched the forums, but couldn't find anything except old
>
> threads that may not be applicable anymore - is there a way to cancel
>
> all subsequent tests when one test fails?
>
>
>
> Thank you!
>
>
>
> Mark
>
>
>
> --
>
> You received this message because you are subscribed to the Google Groups "testng-users" group.
>
> To post to this group, send email to [hidden email].
>
> To unsubscribe from this group, send email to [hidden email].
>
> For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
>
>
>
>
>
>
> --
> Cédric

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/ElUq_cuEA_kJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to stop a test suite if one method fails

Krishnan Mahadevan
Alexander,

I believe the "status-quo" remains the same and I am not aware of anything that would cause subsequent tests to cancel off if one test fails.

If we are referring to @Test annotated methods when we say "Tests", then this can be done by using dependsOn, but I dont think this can be done if we are referring to <test> tags in the suite file.


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/


On Wed, Aug 8, 2012 at 5:54 PM, Alexander Schikora <[hidden email]> wrote:
One year has passed, is there anything implemented by now that would allow this?

Am Montag, 18. April 2011 20:41:47 UTC+2 schrieb Cedric:
> No, there is no such thing at the moment.
>
>
> -- 
> Cédric
>
>
>
>
> On Mon, Apr 18, 2011 at 9:10 AM, mwaschkowski <[hidden email]> wrote:
>
>
> Hi,
>
>
>
> I've searched the forums, but couldn't find anything except old
>
> threads that may not be applicable anymore - is there a way to cancel
>
> all subsequent tests when one test fails?
>
>
>
> Thank you!
>
>
>
> Mark
>
>
>
> --
>
> You received this message because you are subscribed to the Google Groups "testng-users" group.
>
> To post to this group, send email to [hidden email].
>
> To unsubscribe from this group, send email to [hidden email].
>
> For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
>
>
>
>
>
>
> --
> Cédric

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/ElUq_cuEA_kJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to stop a test suite if one method fails

Harini

Any update on this please?

One use case: If the test site is broken and the first test fails because we cannot log into the site anymore, I would like to end the test build since there is no point in running all the tests.

Appreciate any alternatives if this is not possible with TestNG.
 
Thanks,
Harini

On Wednesday, August 8, 2012 6:40:39 AM UTC-7, Krishnan wrote:
Alexander,

I believe the "status-quo" remains the same and I am not aware of anything that would cause subsequent tests to cancel off if one test fails.

If we are referring to @Test annotated methods when we say "Tests", then this can be done by using dependsOn, but I dont think this can be done if we are referring to <test> tags in the suite file.


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;">http://wakened-cognition.blogspot.com/


On Wed, Aug 8, 2012 at 5:54 PM, Alexander Schikora <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="HqNIFxo4adgJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">asb...@...> wrote:
One year has passed, is there anything implemented by now that would allow this?

Am Montag, 18. April 2011 20:41:47 UTC+2 schrieb Cedric:
> No, there is no such thing at the moment.
>
>
> -- 
> Cédric
>
>
>
>
> On Mon, Apr 18, 2011 at 9:10 AM, mwaschkowski <[hidden email]> wrote:
>
>
> Hi,
>
>
>
> I've searched the forums, but couldn't find anything except old
>
> threads that may not be applicable anymore - is there a way to cancel
>
> all subsequent tests when one test fails?
>
>
>
> Thank you!
>
>
>
> Mark
>
>
>
> --
>
> You received this message because you are subscribed to the Google Groups "testng-users" group.
>
> To post to this group, send email to [hidden email].
>
> To unsubscribe from this group, send email to testng-users...@googlegroups.com.
>
> For more options, visit this group at <a href="http://groups.google.com/group/testng-users?hl=en" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;" onclick="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;">http://groups.google.com/group/testng-users?hl=en.
>
>
>
>
>
>
> --
> Cédric

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit <a href="https://groups.google.com/d/msg/testng-users/-/ElUq_cuEA_kJ" target="_blank" onmousedown="this.href='https://groups.google.com/d/msg/testng-users/-/ElUq_cuEA_kJ';return true;" onclick="this.href='https://groups.google.com/d/msg/testng-users/-/ElUq_cuEA_kJ';return true;">https://groups.google.com/d/msg/testng-users/-/ElUq_cuEA_kJ.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="HqNIFxo4adgJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng...@....
To unsubscribe from this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="HqNIFxo4adgJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng-users...@googlegroups.com.
For more options, visit this group at <a href="http://groups.google.com/group/testng-users?hl=en" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;" onclick="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;">http://groups.google.com/group/testng-users?hl=en.


--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to stop a test suite if one method fails

Jeff-351
Unless I am missing something, add a @BeforeSuite method to validate that the site is up and functioning.  That should stop all tests if it fails. 

You could also create a set of validation @Test methods and put them in a "validation" group and make all other test classes depend on that group passing using the 'dependsOnGroups' value in the annotation.
 


On Mon, Jul 14, 2014 at 10:14 AM, Harini <[hidden email]> wrote:

Any update on this please?

One use case: If the test site is broken and the first test fails because we cannot log into the site anymore, I would like to end the test build since there is no point in running all the tests.

Appreciate any alternatives if this is not possible with TestNG.
 
Thanks,
Harini

On Wednesday, August 8, 2012 6:40:39 AM UTC-7, Krishnan wrote:
Alexander,

I believe the "status-quo" remains the same and I am not aware of anything that would cause subsequent tests to cancel off if one test fails.

If we are referring to @Test annotated methods when we say "Tests", then this can be done by using dependsOn, but I dont think this can be done if we are referring to <test> tags in the suite file.


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/


On Wed, Aug 8, 2012 at 5:54 PM, Alexander Schikora <[hidden email]> wrote:
One year has passed, is there anything implemented by now that would allow this?

Am Montag, 18. April 2011 20:41:47 UTC+2 schrieb Cedric:
> No, there is no such thing at the moment.
>
>
> -- 
> Cédric
>
>
>
>
> On Mon, Apr 18, 2011 at 9:10 AM, mwaschkowski <[hidden email]> wrote:
>
>
> Hi,
>
>
>
> I've searched the forums, but couldn't find anything except old
>
> threads that may not be applicable anymore - is there a way to cancel
>
> all subsequent tests when one test fails?
>
>
>
> Thank you!
>
>
>
> Mark
>
>
>
> --
>
> You received this message because you are subscribed to the Google Groups "testng-users" group.
>
> To post to this group, send email to [hidden email].
>
> To unsubscribe from this group, send email to testng-users...@googlegroups.com.
>
> For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
>
>
>
>
>
>
> --
> Cédric

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/ElUq_cuEA_kJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.


--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.



--
Jeff Vincent
See my LinkedIn profile at:
http://www.linkedin.com/in/rjeffreyvincent

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to stop a test suite if one method fails

Harini

Thanks Jeff!

I like the @BeforeSuite approach. I will try that.

On Monday, July 14, 2014 9:28:01 AM UTC-7, Jeff wrote:
Unless I am missing something, add a @BeforeSuite method to validate that the site is up and functioning.  That should stop all tests if it fails. 

You could also create a set of validation @Test methods and put them in a "validation" group and make all other test classes depend on that group passing using the 'dependsOnGroups' value in the annotation.
 


On Mon, Jul 14, 2014 at 10:14 AM, Harini <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="E99j3oFXrkwJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">zii...@...> wrote:

Any update on this please?

One use case: If the test site is broken and the first test fails because we cannot log into the site anymore, I would like to end the test build since there is no point in running all the tests.

Appreciate any alternatives if this is not possible with TestNG.
 
Thanks,
Harini

On Wednesday, August 8, 2012 6:40:39 AM UTC-7, Krishnan wrote:
Alexander,

I believe the "status-quo" remains the same and I am not aware of anything that would cause subsequent tests to cancel off if one test fails.

If we are referring to @Test annotated methods when we say "Tests", then this can be done by using dependsOn, but I dont think this can be done if we are referring to <test> tags in the suite file.


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;">http://wakened-cognition.blogspot.com/


On Wed, Aug 8, 2012 at 5:54 PM, Alexander Schikora <[hidden email]> wrote:
One year has passed, is there anything implemented by now that would allow this?

Am Montag, 18. April 2011 20:41:47 UTC+2 schrieb Cedric:
> No, there is no such thing at the moment.
>
>
> -- 
> Cédric
>
>
>
>
> On Mon, Apr 18, 2011 at 9:10 AM, mwaschkowski <[hidden email]> wrote:
>
>
> Hi,
>
>
>
> I've searched the forums, but couldn't find anything except old
>
> threads that may not be applicable anymore - is there a way to cancel
>
> all subsequent tests when one test fails?
>
>
>
> Thank you!
>
>
>
> Mark
>
>
>
> --
>
> You received this message because you are subscribed to the Google Groups "testng-users" group.
>
> To post to this group, send email to [hidden email].
>
> To unsubscribe from this group, send email to testng-users...@googlegroups.com.
>
> For more options, visit this group at <a href="http://groups.google.com/group/testng-users?hl=en" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;" onclick="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;">http://groups.google.com/group/testng-users?hl=en.
>
>
>
>
>
>
> --
> Cédric

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit <a href="https://groups.google.com/d/msg/testng-users/-/ElUq_cuEA_kJ" target="_blank" onmousedown="this.href='https://groups.google.com/d/msg/testng-users/-/ElUq_cuEA_kJ';return true;" onclick="this.href='https://groups.google.com/d/msg/testng-users/-/ElUq_cuEA_kJ';return true;">https://groups.google.com/d/msg/testng-users/-/ElUq_cuEA_kJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at <a href="http://groups.google.com/group/testng-users?hl=en" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;" onclick="this.href='http://groups.google.com/group/testng-users?hl\75en';return true;">http://groups.google.com/group/testng-users?hl=en.


--
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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="E99j3oFXrkwJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="E99j3oFXrkwJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng...@....
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.



--
Jeff Vincent
See my LinkedIn profile at:
<a href="http://www.linkedin.com/in/rjeffreyvincent" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.linkedin.com%2Fin%2Frjeffreyvincent\46sa\75D\46sntz\0751\46usg\75AFQjCNFJszVU3e8UPeGdKd7SrNZhMsseiw';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.linkedin.com%2Fin%2Frjeffreyvincent\46sa\75D\46sntz\0751\46usg\75AFQjCNFJszVU3e8UPeGdKd7SrNZhMsseiw';return true;">http://www.linkedin.com/in/rjeffreyvincent

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to stop a test suite if one method fails

Andrew McElroy
Here is my "solution" (i.e. work-around) for this issue.  It might not solve your specific case but it's good enough for my problem.

First, I added a variable with a getter and setting in my main class to flag whether or not we should abort the entire test suite:

 
    public static Boolean abortTestSuite = false;

   
public static Boolean getAbortTestSuite() {
       
return abortTestSuite;
   
}

   
public static void setAbortTestSuite(Boolean abortTestSuite) {
       
TestBedEnv.abortTestSuite = abortTestSuite;
   
}

Next I set "abortTestSuite" in any test case that might trigger the entire suite to fail (in my case I wanted to add setup stuff as test cases as opposed to putting it in @BeforeSuite).  So my test case could look something like this:

    @Test(priority = -10)
   
public void test01() throws Exception {
       
// if something catastrophic happens then....
       
TestBedEnv.setAbortTestSuite(true);
   
}

Finally, in my Listener, I add a check for this variable in "onStartTest":

    @Override
   
public void onTestStart(ITestResult tr) {
       
if (TestBedEnv.getAbortTestSuite()) {
           
throw new SkipException ("Skipping Test: " + tr.getName());
       
}
   
}

This will result in ALL test cases (AFTER the one where we set "abortTestSuite" to true) to be skipped.  They will not execute and will show up in the log as skipped.  This way I do not need to remember to add "dependsOnGroups" to new test cases or anything else like that.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to stop a test suite if one method fails

djangofan-2
In reply to this post by Mark Waschkowski
Here is how I do it.  I define it in my testing.xml  .   I have one test in the group called "critical"  and it is called "FastFailTest".

<suite name="Regression Test Suite" time-out="3600000" preserve-order="true" parallel="classes" thread-count="50">
  <listeners>
    <listener class-name="myFramework.engine.test.selenium.common.helper.CustomReport" />
  </listeners>
  <test name="Regression Tests" preserve-order="true">
    <groups>
            <dependencies>
                <group name="regression" depends-on="critical" />
            </dependencies>
        </groups>
    <classes>
    <class name="co.tests.UN00_FailFastSimpleSearch"/>
    <class name="co.tests.UN01_NameSearch" />
      ....


-Jon

On Monday, April 18, 2011 9:10:43 AM UTC-7, mwaschkowski wrote:
Hi,

I've searched the forums, but couldn't find anything except old
threads that may not be applicable anymore - is there a way to cancel
all subsequent tests when one test fails?

Thank you!

Mark

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to stop a test suite if one method fails

Nguyen Thai Hoang
Hi all,
I met the same issue above. Below is my test suite, have 4 test cases, my expectation results is: if one test case running failed, other test cases in the test suite will not run, and TestNG will go ahead to run other test suite.

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<suite name="SOAPUI" verbose="3">
    <test name="SOAPUI024">
        <classes>
            <class name="TestLab.APOutsource.SOAPUI.SOAPUI024" />
        </classes>
    </test>
    <test name="SOAPUI025">
        <classes>
            <class name="TestLab.APOutsource.SOAPUI.SOAPUI025" />
        </classes>
    </test>
    <test name="SOAPUI026">
        <classes>
            <class name="TestLab.APOutsource.SOAPUI.SOAPUI026" />
        </classes>
    </test>
    <test name="SOAPUI027">
        <classes>
            <class name="TestLab.APOutsource.SOAPUI.SOAPUI027" />
        </classes>
    </test>
</suite>

For example: Test case SOAPUI025 failed while running, the TestNG will skip test case SOAPUI026 and SOAPUI027, and will run other test suite (if any)

I'm using TestNG 6.9.9 and interact with Selenium
Any suggest? Many thanks

PS: sorry my bad English

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to stop a test suite if one method fails

Krishnan Mahadevan
​One of the ways in which you can achieve this is by creating a Listener as below and wire it to your suite xml file.

@Listeners(ListenerSample.Listen.class)
public class ListenerSample {
@Test
public void test1() {
System.err.println("test1() executed");
}

@Test
public void test2() {
System.err.println("test2() executed");
throw new RuntimeException("Simulating a failure");
}

@Test
public void test3() {
System.err.println("test3() will never be executed");
}

public static class Listen implements IInvokedMethodListener {
private boolean hasFailures = false;

@Override
public void beforeInvocation(IInvokedMethod method, ITestResult testResult) {
synchronized (this) {
if (hasFailures) {
throw new SkipException("Skipping this test");
}
}
}

@Override
public void afterInvocation(IInvokedMethod method, ITestResult testResult) {
if (! method.isTestMethod()) {
return;
}
if (! testResult.isSuccess()) {
synchronized (this) {
hasFailures = true;
}
}

}
}
}


Here's the output 

Inline image 1


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/

On Tue, Nov 17, 2015 at 12:06 PM, Nguyen Thai Hoang <[hidden email]> wrote:
Hi all,
I met the same issue above. Below is my test suite, have 4 test cases, my expectation results is: if one test case running failed, other test cases in the test suite will not run, and TestNG will go ahead to run other test suite.

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<suite name="SOAPUI" verbose="3">
    <test name="SOAPUI024">
        <classes>
            <class name="TestLab.APOutsource.SOAPUI.SOAPUI024" />
        </classes>
    </test>
    <test name="SOAPUI025">
        <classes>
            <class name="TestLab.APOutsource.SOAPUI.SOAPUI025" />
        </classes>
    </test>
    <test name="SOAPUI026">
        <classes>
            <class name="TestLab.APOutsource.SOAPUI.SOAPUI026" />
        </classes>
    </test>
    <test name="SOAPUI027">
        <classes>
            <class name="TestLab.APOutsource.SOAPUI.SOAPUI027" />
        </classes>
    </test>
</suite>

For example: Test case SOAPUI025 failed while running, the TestNG will skip test case SOAPUI026 and SOAPUI027, and will run other test suite (if any)

I'm using TestNG 6.9.9 and interact with Selenium
Any suggest? Many thanks

PS: sorry my bad English

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to stop a test suite if one method fails

Hoang Nguyen
In reply to this post by Mark Waschkowski
Hi all,

I've found out the solution for my scenrio by using dependsOnGroups and Dependencies in XML

1. I separate one real testcase into one class
2. I set testcase primary with Anotation @Test(groups = { "Primary" })



3. I set testcase dependency with Anotation @Test(groups = {"Dependency"}) 


---> It means testcase SOAPUI005 depends on SOAPUI003, when SOAPUI003 fail, it will not run testcase SOAPUI005

4. On testsuite.xml



5. When test case SOAPUI003 failed --> it will skip running SOAPUI005




--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to stop a test suite if one method fails

akshay.maldhure
In reply to this post by Jeff-351
Thanks Jeff! The @BeforeSuite approach works like a charm. :)

On Monday, July 14, 2014 at 9:58:01 PM UTC+5:30, Jeff wrote:
Unless I am missing something, add a @BeforeSuite method to validate that the site is up and functioning.  That should stop all tests if it fails. 

You could also create a set of validation @Test methods and put them in a "validation" group and make all other test classes depend on that group passing using the 'dependsOnGroups' value in the annotation.
 


On Mon, Jul 14, 2014 at 10:14 AM, Harini <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="E99j3oFXrkwJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">zii...@...> wrote:

Any update on this please?

One use case: If the test site is broken and the first test fails because we cannot log into the site anymore, I would like to end the test build since there is no point in running all the tests.

Appreciate any alternatives if this is not possible with TestNG.
 
Thanks,
Harini

On Wednesday, August 8, 2012 6:40:39 AM UTC-7, Krishnan wrote:
Alexander,

I believe the "status-quo" remains the same and I am not aware of anything that would cause subsequent tests to cancel off if one test fails.

If we are referring to @Test annotated methods when we say "Tests", then this can be done by using dependsOn, but I dont think this can be done if we are referring to <test> tags in the suite file.


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/


On Wed, Aug 8, 2012 at 5:54 PM, Alexander Schikora <[hidden email]> wrote:
One year has passed, is there anything implemented by now that would allow this?

Am Montag, 18. April 2011 20:41:47 UTC+2 schrieb Cedric:
> No, there is no such thing at the moment.
>
>
> -- 
> Cédric
>
>
>
>
> On Mon, Apr 18, 2011 at 9:10 AM, mwaschkowski <[hidden email]> wrote:
>
>
> Hi,
>
>
>
> I've searched the forums, but couldn't find anything except old
>
> threads that may not be applicable anymore - is there a way to cancel
>
> all subsequent tests when one test fails?
>
>
>
> Thank you!
>
>
>
> Mark
>
>
>
> --
>
> You received this message because you are subscribed to the Google Groups "testng-users" group.
>
> To post to this group, send email to [hidden email].
>
> To unsubscribe from this group, send email to testng-users...@googlegroups.com.
>
> For more options, visit this group at <a href="http://groups.google.com/group/testng-users?hl=en" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://groups.google.com/group/testng-users?hl\x3den&#39;;return true;" onclick="this.href=&#39;http://groups.google.com/group/testng-users?hl\x3den&#39;;return true;">http://groups.google.com/group/testng-users?hl=en.
>
>
>
>
>
>
> --
> Cédric

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit <a href="https://groups.google.com/d/msg/testng-users/-/ElUq_cuEA_kJ" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msg/testng-users/-/ElUq_cuEA_kJ&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msg/testng-users/-/ElUq_cuEA_kJ&#39;;return true;">https://groups.google.com/d/msg/testng-users/-/ElUq_cuEA_kJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at <a href="http://groups.google.com/group/testng-users?hl=en" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://groups.google.com/group/testng-users?hl\x3den&#39;;return true;" onclick="this.href=&#39;http://groups.google.com/group/testng-users?hl\x3den&#39;;return true;">http://groups.google.com/group/testng-users?hl=en.


--
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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="E99j3oFXrkwJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="E99j3oFXrkwJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng...@....
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://groups.google.com/group/testng-users&#39;;return true;" onclick="this.href=&#39;http://groups.google.com/group/testng-users&#39;;return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.



--
Jeff Vincent
See my LinkedIn profile at:
<a href="http://www.linkedin.com/in/rjeffreyvincent" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.linkedin.com%2Fin%2Frjeffreyvincent\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFJszVU3e8UPeGdKd7SrNZhMsseiw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.linkedin.com%2Fin%2Frjeffreyvincent\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFJszVU3e8UPeGdKd7SrNZhMsseiw&#39;;return true;">http://www.linkedin.com/in/rjeffreyvincent

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Loading...