In arquillian incontainer mode, why does the Test method get the excluded time square of the values returned by the data provider in testng?
I am using TestNG as Unit Test Framework and Jboss AS7.1.1 Final as server
Data provider and test methods work well in client mode
The same dataparider will return 10 rows and my test method will be executed almost 100 times in container mode
Test Method
@Test(groups="bean-tests",dataProvider="Presenter-Data-Provider")
public void findByIdPositiveTest(long presenterId,String expectedPresenterName)
{
}
Dataprovider method:
@DataProvider(name = "Presenter-Data-Provider")
public Object[][] presenterTestDataProvider()
{
EntityManagerFactory emf=null;
EntityManager em=null;
Object testcaseData[][]=null;
Session session=null;
try
{
emf=Persistence.createEntityManagerFactory("TestCaseDataSource");
em=emf.createEntityManager();
session=em.unwrap(Session.class);
Criteria query=session.createCriteria(TestPresenter.class).setFirstResult(0).setMaxResults(10);
List<TestPresenter> rowList=query.list();
testcaseData=new Object[rowList.size()][2];
for(int loopCount=0;loopCount<rowList.size();loopCount++)
{
TestPresenter row=rowList.get(loopCount);
testcaseData[loopCount][0]=row.getPresenterId();
testcaseData[loopCount][1]=row.getExpectedPresenterName();
}
}
catch(Exception exception)
{
mLog.error(exception.getMessage());
}
return testcaseData;
}
I am running as a test suite using the following Suite configuration
<test name="Bean testing">
<groups>
<run>
<!-- This has to be added by default while using arquillian Test Runner -->
<include name="arquillian" />
<include name="bean-tests" />
</run>
</groups>
<classes>
<class name="blah.blah.blah.PresenterManagerBeanTest" />
</classes>
</test>
Pls tell me what I did was wrong Or direct me how to get values from DB to data and test provider using container mode
Thank you in advance
sathiya seelan
+3
source to share