1 Reply Latest reply on Dec 26, 2013 3:08 AM by robert.panzer

    Debugging problem in Arquillian-Junit test

    arko1983

      Hi,

      I have designed an arquillian test framework in order to make junit test for our application business logic.I have encountered a problem regarding debugging the unit test code.The debug pointer stops at the static methods but fails to stop in the test methods.I have tried several solutions like updating jdk from 1.6 to 1.7  and added the following jvm arguments "-XX:+UseParallelGC", but it didn't work. I am using junit 4.8.1 , jdk 1.7 & Jboss7.1. Below is the test code:-

       

      @Deployment

          public static WebArchive createDeployment() {

            

              return ShrinkWrap.create(WebArchive.class, "test.war")

                   

                      .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")

                      .addAsResource("META-INF/persistence.xml")              

                      .addAsLibraries(DependencyResolvers.use(MavenDependencyResolver.class)

                              .loadEffectivePom("pom.xml")                      

                             .artifact("org.apache.commons:commons-io:1.3.2")

                             .artifact("joda-time:joda-time:1.6")                    

                             .artifact("org.hibernate:hibernate-jpamodelgen:4.3.0.CR1")

                             .artifact("org.hibernate:hibernate-validator:4.3.0.Final")

                             .artifact("commons-lang:commons-lang:2.4")

                               . . .

                             .resolveAsFiles())           

                             .addPackages(false,getCorePackages());                             

          }

       

          public static Package[] getCorePackages() {

              return new Package[] {

                      BusinessDefModule.class.getPackage(),

                      BankTest.class.getPackage(),

                      BusinessDefTest.class.getPackage(),

                      . . .

          }

       

       

          @PersistenceContext

          @Produces

          @Default

          EntityManager em;

       

          @Inject

          UserTransaction utx;

       

          @Inject

          private BusinessDefModule bdf;

       

      @BeforeClass

          public static void beforeTest(){

              . . .     

              log.info("*-------------Test Started-------------*" +  "\n");

          }

       

      @Test

          public void testfetchCustMgmtByCustMaster() {

                      custmanage = bdf.fetchCustMgmtByCustMaster(cust);      

              assertNotNull(custmanage.getId());

               }

       

      Thanks in advance for any help.

      Regards

      Arko

        • 1. Re: Debugging problem in Arquillian-Junit test
          robert.panzer

          Hi Arki,

           

          as you are probably using using a managed or remote container and the tests are not annotated with RunAsClient the test methods are executed in the server VM.

          So you have to connect that VM.

           

          IMO it's best to start the server before the test and let the arquillian connect to that VM for development purposes.

           

          Kind regards,

          Robert