Thanks Haroon and John .

Yes I thought @Factory was supposed to solve this problem . i have attached
a test case which illustrates my problem any solution to this would be
helpful

You need to copy testng5.8 and groovy-all-1.6.0.jar in the lib directory and
you can run ant

Regards
Hari

On Fri, May 15, 2009 at 7:03 PM, Haroon Rasheed <[email protected]>wrote:

> I have not used the @Factory and we use dependsOnMethod whenever we want to
> run tests in a particular sequence, because TestNG orders the tests in a
> sequence before running them. There might be a smarter way to do this which
> I am not aware of. I will look into this.
> You can use @DataProvider to pass the parameters to your tests at the
> run-time. The alternate way is to define the parameters in the TestNG
> suite.xml file for the tests and use @Parameter annotation on the test.
>
>
> Haroon
>
> 2009/5/15 John <[email protected]>
>
>
>> I did not use TestNG a lot. But isn't @Factory used to provide Test
>> classes similar to a Test Suite in JUnit?
>>
>> @Factory: Marks a method as a factory that returns objects that will
>> be used by TestNG as Test classes. The method must return Object[].
>>
>> If you want to provide data to test cases, why not use @DataProvider?
>>
>> @DataProvider: Marks a method as supplying data for a test method. The
>> annotated method must return an Object[][] where each Object[] can be
>> assigned the parameter list of the test method. The @Test method that
>> wants to receive data from this DataProvider needs to use a
>> dataProvider name equals to the name of this annotation.
>>
>>    * name: The name of this DataProvider.
>>
>>
>> On May 14, 11:29 pm, Harihara Vinayakaram <[email protected]> wrote:
>> > 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
-~----------~----~----~----~------~----~------~--~---

Attachment: toCedric.tar.gz
Description: GNU Zip compressed data

Reply via email to