Hi Hari,
TestNG provides a mechanism to handle these situations. You can use
"dependsOnMethod" annotation to define the dependency of one test to the
other. This would ensure that your test runs in a particular order, but the
drawback to this is if one of the test fails then TestNG will not run the
dependent tests.

Therefore the best practice is to make each test method independent of each
other so that running the tests in different orders does not effect the test
execution.

You can try the combination of "dependsOnMethod" and "alwaysRun=true" by
using this you might be able to control the flow of test execution and may
also be able to run the dependent tests. I have not tried this but you can
do this and share your experience with us.


Thanks
Haroon

2009/5/15 Harihara Vinayakaram <[email protected]>

> Hi
>   I have say 3 Tests that do the following :
>
>      @Test
>      Login,
>
>      @Test (dependsOnMethods="Login"
>      Click
>
>       @Test(dependsOnMethods="Click")
>       Logout
>
>   I have to run these tests for 3 users . I pass the parameters to these
> tests in a @Factory method
>
>   @Factory
>    testData() {
>        return list.toArray() .  //This contains the username and password
> in an object
>    }
>
>    my testng.xml says
>       <suite  name="xxx">
>           <classes name="MyClass" />
>       </suite>
>
> Ideally I would like the tests to be run as
>      Login(user1), Click(user1),Logout(user1)
>      Login(user2), Click(user2),Logout(user2)
>
> But what happens is that :
>       Login(user1), Login(user2), Login(user3)
>
> I am not able to find out a way to run the tests as desired
>
> Regards
> Hari
>
> >
>

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

Reply via email to