Creating instances of same object using different Factory class

15 views
Skip to first unread message

pradeep pillai

unread,
Dec 8, 2017, 3:54:18 AM12/8/17
to testng-users
hi all,

I am getting sporadic failures and not able to pin point the exact failures. My test user is getting logged out. It is not deterministic as failures are not consistent.

Please find stripped down version of code (options we have each type of user are huge and also the type of user is large.)

Class MyFactoryOne {
private Object[][] data;

@Factory(dataProvider="dp")
public Object[] createInstances(User user) {
return new Object[] { new TestFolderPermissionForUser(user)}; }
}

  @DataProvider(name="dp")
  public Object[][] dataProvider() {
  //
//create some user and login (login info stored in user object)
//
data = {{user1}, {user2}}
return data;
}

Class MyFactoryTwo {
private Object[][] data;

@Factory(dataProvider="dp")
public Object[] createInstances(User user) {
return new Object[] { new TestFolderPermissionForUser(user)}; }
}

  @DataProvider(name="dp")
  public Object[][] dataProvider() {
  //
//create some different type of user and login (login info stored in user object)
//
data = {{user1}, {user2}}
return data;
}

Class TestFolderPermissionForUser {
private User u;
TestFolderPermissionForUser(User u) {
this.u = u;
}

@Test
read() {

}

@Test (dependsOnMethod = "read")
rename() {

}

@Test (dependsOnMethod = "read")
delete() {

}
}


<suite parallel="tests" thread-count="5">
    
    <test name="Test for free user" group-by-instances="true">
        <classes>
            <class name="com.test.MyFactoryOne"/>
        </classes>
    </test>
    <test name="Test for paid user" group-by-instances="true">
        <classes>
            <class name="com.test.MyFactoryTwo"/>
        </classes>
    </test>
</suite>

Krishnan Mahadevan

unread,
Dec 8, 2017, 10:34:07 PM12/8/17
to testng...@googlegroups.com

Can you please let us know what issue you are facing with respect to TestNG ?

Can you share a standalone sample, that can be executed to reproduce the issue you are facing ?

 

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/

--
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 https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages