[testng-users] Defining Dependency Between Tests in testng.xml

1,173 views
Skip to first unread message

perry123

unread,
Jun 4, 2010, 1:39:10 PM6/4/10
to testng...@googlegroups.com

Hi, I am newbie to testng so trying to achieve following :

I already have lot of java testng classes , and they are part of test suite
as follows:

<test name="Test1">
<classes>
<class name="myClass1">
<class name="myClass2">
<class name="myClass3">
<classes>
</test>


so my question , can I add a new test suite to same xml or test and have one
test dependent on other , so that it fails rest of the tests are skipped ,
something like:

<test name="Test2">
<classes>
<class name="myclass4">
<classes>
</test>

<test name="Test1" dependsOnTest="Test2">
<classes>
<class name="myClass1">
<class name="myClass2">
<class name="myClass3">
<classes>
</test>

So , the test1 should be skipped when test2 fails.

I really don't want to make any changes to java class files...


Thanks
--
View this message in context: http://old.nabble.com/Defining-Dependency-Between-Tests-in-testng.xml-tp28783013p28783013.html
Sent from the testng-users mailing list archive at Nabble.com.

Cédric Beust ♔

unread,
Jun 7, 2010, 7:12:50 AM6/7/10
to testng...@googlegroups.com
1) Dependencies only work within the same <test> tag

2) The only way to use TestNG today is to use annotations, so you will have to modify your classes...

--
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 testng...@googlegroups.com.
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

ziggylicious

unread,
Jun 18, 2010, 12:34:50 PM6/18/10
to testng-users
Cedric is right.

But i guess the least you could do is to include @Test(sequential-
true) annotation before class definition in your java code.

For instance,


@Test(sequential=true)
public class MyClass {
.
.
.
}


Hope this helps.

Ann
> >http://old.nabble.com/Defining-Dependency-Between-Tests-in-testng.xml...
> > Sent from the testng-users mailing list archive at Nabble.com.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "testng-users" group.
> > To post to this group, send email to testng...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > testng-users...@googlegroups.com<testng-users%2Bunsubscribe@google groups.com>
> > .
Reply all
Reply to author
Forward
0 new messages