3 Replies Latest reply on Aug 29, 2013 9:06 AM by bmajsak

    Using several and related datasets

    neopk

      Hi,

       

      I have a problem for a testClass with 4 tests and 1 who need related dataset.

       

      I have 2 datasets :

       

      user.xml :

      <dataset>

          <user id="1" codeTitle="Mr" nom="MICHU" prenom ="Miguel"/>

      </dataset>

       

      title.xml

      <dataset>

          <title codeTitle="Mr" label="Mister"/>

      </dataset>

       

      In my test tests works but the test executed after the test who need several datasets, i used @UsingDataSet({"user.xml", "title.xml" }), all tests passed exept the last which is after the related dataset's test.

       

      @UsingDataSet("test.xml")

      test 1

       

      @UsingDataSet("test.xml")

      test 2

       

      @UsingDataSet({"title.xml", "user.xml" })

      test 3

       

      @UsingDataSet("test.xml")

      test 4

       

      Each test passed except the 4th test, if i delete the third test, the 4th pass but if i only put the relationnal dataset with empty test the test 4 is not executed...

      So i think I made something bad for the relation, maybe anyone will have an idea ?

       

      For informations, i'm using testNG

       

      Thanks and sorry for my english.

        • 1. Re: Using several and related datasets
          bmajsak

          Hi,

           

          in order to help you I need some more details

          1. What kind of test failure message are you getting?

          2. Is there something related in the server logs?

           

          And last but not least, would it be possible to share the code so I can investigate the problem using "working" example?

           

          Cheers,

          Bartosz

          • 2. Re: Using several and related datasets
            neopk

            Hi,

             

            Thanks for your response.

             

            My test class is very simple because i would understand how to pass several datasets :

             

            /**

            * Classe de test pour l'ejb UserBean.

            *

            * @author

            */

            @Test

            public class UserBeanTest extends Arquillian {

             

               

                /** User. */

                @EJB

                private UserBean userBean;

             

                /**

                 * Creation du war à tester.

                 *

                 * @return l'archive générée.

                 * @throws ClassNotFoundException

                 */

                @Deployment

                public static Archive<?> createDeploymentPackage() throws ClassNotFoundException {

                    return Deploiement.getArchive(UserBean.class, User.class);

                }

             

                @Test(priority = 3)

                @UsingDataSet("test2.xml")

                public void testSearchUser() {

                    System.out.println("-------------test1-----------------------------");

                }

             

                @Test(priority = 1)

                @UsingDataSet("test2.xml")

                public void testSearchById() {

                    System.out.println("-------------test2-----------------------------");

                }

             

             

                @Test(priority = 1)

                @UsingDataSet("test2.xml")

                public void testSearchByName() {

                    System.out.println("-------------test3-----------------------------");

                }

             

                @Test(priority = 2)

                @UsingDataSet({ "title.xml", "user.xml" })

                public void testSearchByNameTitle() {

                    System.out.println("-------------test4-----------------------------");

                }

             

            }

             

            In my user.xml :

            <dataset>

                <user id="1" codeTitle="Mr" lastname="PENDI" firstname="Jean"/>

            </dataset>

             

            In my title.xml

            <dataset>

                <title codeTitle="Ms" label="Miss" />

                <title codeTitle="Mr" label="Mister" />

                <title codeTitle="CH" label="Child" />

            </dataset>

             

            In My test2.xml (without column which have relationship)

            <dataset>

                <user id="1"  lastname="PENDI" firstname="Jean"/>

            </dataset>

             

            I don't have code in test because i would know if the problem came from my test. And I put priority to be sure that the 4th test will not be the least. In this case the test 1 is not passed because I don't have the sysout in the console, despite of testNG said me that 4 test passed.

             

            And there is nothing in logs and no message failure ...

             

            Thanks for your help

            • 3. Re: Using several and related datasets
              bmajsak

              Hi neopk,

               

              With Alpha6 I solved the problem which might be related to your case. In brief datasets  were not executed in the order they were specified in the annotation. Have you tried with Alpha6? Does the problem still exist?