0 Replies Latest reply on Feb 15, 2013 8:23 AM by sathiya seelan

    Test is getting executed multiples of number or rows returned by @Dataprovider (TestNG)and I'm using in container Mode

    sathiya seelan Newbie

      I'm using TestNG as Unit Test Framework and  Jboss AS7.1.1 Final as server


      The data provider  and Test methods works well in Client Mode


      The same dataprovider will return 10 rows and my Test method is getting executed nearly 100times in In container mode


      Test method :



         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;






                  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);








              catch(Exception exception)




              return testcaseData;




      I'm running as Test Suite using folowing Suite configuration


      <?xml version="1.0" encoding="UTF-8"?>

      <suite name="Development test suite">


          <test name="Bean testing">



                      <!-- This has to be added by default while using arquillian Test Runner -->

                      <include name="arquillian" />

                      <include name="bean-tests" />





                  <class name="blah.blah.blah.PresenterManagerBeanTest" />




      Pls let me know What I did was wrong

      Or direct me how to get values from DB  to Data provider and tests using In container mode


      Thanks in advance


      sathiya seelan