6 Replies Latest reply on Jan 11, 2012 9:15 AM by Amos Feng

    collect code coverage by using jacoco-extension

    Amos Feng Apprentice

      I managed to run coverage on jbossxts by using jacoco-extension. Our test cases need to run in the container, and now jacoco could only collecte the data of these test cases but not XTS codes.

       

      e.g. test case running in the container

       

      public class NestedTransaction
      {
          public void testNestedTransaction()
                  throws Exception {
               UserTransaction ut = UserTransaction.getUserTransaction();
               try {
                   ut.begin();             ut.begin();
                   ut.commit();
                   ut.commit();
                   fail("expected WrongStateException");
               } catch(...) {
                   ...
               }
           }
      }  
      

       

      deploy and test via arquillian

       

      @RunWith(Arquillian.class)
      public class NestedTransactionTest {
          @Inject
          NestedTransaction test;
      
          @Deployment
          public static WebArchive createDeployment() {
              return WarDeployment.getDeployment(NestedTransaction.class);
          }
      
          @Test
          public void test() throws Exception {
              test.testNestedTransaction();
          }
      }
      

      so my question is it possible to control the jars instrumented with jacoco ? or we need a new feather about jacoco-extension ?

       

      Thanks,

      Amos