dimanche 29 avril 2018

Multiple arquillian based test files starts the context mutliple times

I have 2 test files

     @RunWith(Arquillian.class)
        public class Test_class_1{

            @Inject
            private Something something;

            @Deployment(name = "deployment_name", order = 1)
            public static WebArchive createInventory() {
                return AbstractArquillian.createWarFile("abcd.war",
                        "src" + File.separatorChar + "test" + File.separatorChar + "resources" + File.separatorChar + "META-INF"
                                + File.separatorChar + "persistence-test.xml",
                        "META-INF" + File.separatorChar + "beans-test.xml");

            }

          @Test
          public void test_method () {
             ...
             ...
             ...
          }


    }


    @RunWith(Arquillian.class)
            public class Test_class_2{

                @Inject
                private Something something;

                @Deployment(name = "deployment_name", order = 1)
                public static WebArchive createInventory() {
                    return AbstractArquillian.createWarFile("abcd.war",
                            "src" + File.separatorChar + "test" + File.separatorChar + "resources" + File.separatorChar + "META-INF"
                                    + File.separatorChar + "persistence-test.xml",
                            "META-INF" + File.separatorChar + "beans-test.xml");

                }


                @Test
                public void test_method () {
                   ...
                   ...
                   ...
                }

        }

There are 2 test files because test cases are logically different. But i want to start the context only once so that it takes less time. how should i modify it to achieve it? Spring integration test caches the context. isn't such thing available in arquillian.

Aucun commentaire:

Enregistrer un commentaire