Skip tests when dependencies aren't met

76 views
Skip to first unread message

edwolb

unread,
Feb 20, 2013, 3:47:06 PM2/20/13
to testng...@googlegroups.com
We've setup a programmatic test selector which identifies different methods to execute, and creates an XmlSuite to execute them.  However recently someone injected a method that had a depdendency that wasn't met.  I would have expected TestNG to skip this test, however it threw an exception instead which we couldn't catch.  The result is that the entire build fails rather than just skipping tests that can't be executed.

Is there a reason this isn't implemented as a skip?

com.automation.tests.general.search.TC_Restricted.verifyCPACanSeePatients() is depending on method public void com.automation.tests.general.search.TC_Restricted.verifyC() throws java.lang.Exception, which is not annotated with @Test or not included.
[java] 	at org.testng.internal.MethodHelper.findDependedUponMethods(MethodHelper.java:111)
     [java] 	at org.testng.internal.MethodHelper.topologicalSort(MethodHelper.java:240)
     [java] 	at org.testng.internal.MethodHelper.sortMethods(MethodHelper.java:317)
     [java] 	at org.testng.internal.MethodHelper.collectAndOrderMethods(MethodHelper.java:59)
     [java] 	at org.testng.TestRunner.initMethods(TestRunner.java:481)
     [java] 	at org.testng.TestRunner.init(TestRunner.java:235)
     [java] 	at org.testng.TestRunner.init(TestRunner.java:205)
     [java] 	at org.testng.TestRunner.<init>(TestRunner.java:153)
     [java] 	at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:522)
     [java] 	at org.testng.SuiteRunner.init(SuiteRunner.java:157)
     [java] 	at org.testng.SuiteRunner.<init>(SuiteRunner.java:111)
     [java] 	at org.testng.TestNG.createSuiteRunner(TestNG.java:1273)
     [java] 	at org.testng.TestNG.createSuiteRunners(TestNG.java:1260)
     [java] 	at org.testng.TestNG.runSuitesLocally(TestNG.java:1114)
     [java] 	at org.testng.TestNG.run(TestNG.java:1031)

Krishnan Mahadevan

unread,
Feb 20, 2013, 9:13:00 PM2/20/13
to testng...@googlegroups.com
I believe TestNG is rightly throwing an exception to indicate a mistake on the user part rather than skipping the test. 
--
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 post to this group, send email to testng...@googlegroups.com.
Visit this group at http://groups.google.com/group/testng-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
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/

edwolb

unread,
Feb 20, 2013, 9:17:48 PM2/20/13
to testng...@googlegroups.com
Do you know of any way I can identify and include dependencies?  Currently I'm adding XmlIncludes to an XmlClass, but I don't see any methods that might allow me to identify the dependencies pro-actively.

Thank you

--
Chris

On Wednesday, 20 February 2013 21:13:00 UTC-5, Krishnan wrote:
I believe TestNG is rightly throwing an exception to indicate a mistake on the user part rather than skipping the test. 

On Thursday, February 21, 2013, edwolb wrote:
We've setup a programmatic test selector which identifies different methods to execute, and creates an XmlSuite to execute them.  However recently someone injected a method that had a depdendency that wasn't met.  I would have expected TestNG to skip this test, however it threw an exception instead which we couldn't catch.  The result is that the entire build fails rather than just skipping tests that can't be executed.

Is there a reason this isn't implemented as a skip?

com.automation.tests.general.search.TC_Restricted.verifyCPACanSeePatients() is depending on method public void com.automation.tests.general.search.TC_Restricted.verifyC() throws java.lang.Exception, which is not annotated with @Test or not included.
[java] 	at org.testng.internal.MethodHelper.findDependedUponMethods(MethodHelper.java:111)
     [java] 	at org.testng.internal.MethodHelper.topologicalSort(MethodHelper.java:240)
     [java] 	at org.testng.internal.MethodHelper.sortMethods(MethodHelper.java:317)
     [java] 	at org.testng.internal.MethodHelper.collectAndOrderMethods(MethodHelper.java:59)
     [java] 	at org.testng.TestRunner.initMethods(TestRunner.java:481)
     [java] 	at org.testng.TestRunner.init(TestRunner.java:235)
     [java] 	at org.testng.TestRunner.init(TestRunner.java:205)
     [java] 	at org.testng.TestRunner.<init>(TestRunner.java:153)
     [java] 	at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:522)
     [java] 	at org.testng.SuiteRunner.init(SuiteRunner.java:157)
     [java] 	at org.testng.SuiteRunner.<init>(SuiteRunner.java:111)
     [java] 	at org.testng.TestNG.createSuiteRunner(TestNG.java:1273)
     [java] 	at org.testng.TestNG.createSuiteRunners(TestNG.java:1260)
     [java] 	at org.testng.TestNG.runSuitesLocally(TestNG.java:1114)
     [java] 	at org.testng.TestNG.run(TestNG.java:1031)

--
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 http://groups.google.com/group/testng-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply all
Reply to author
Forward
0 new messages