0 Replies Latest reply on Nov 14, 2017 2:32 AM by cwansart

    Does Arquillians JaCoCo Plugin support blackbox testing (@RunAsClient and ClientBuilder)?

    cwansart

      Hello,

       

      I have a project that has the following structure:

       

      ROOT

        -> parent

        -> build-tools

        -> service1

        -> service2

        -> service3 ...

       

      The parent holds information for versions, plugins, etc. Now I have integration tests inside the services that fail when I run them together with @RunAsClient. I created a minimal rest endpoint and a test to check that:

      @Path("cc")
      public class CcTestResource {
      
      
        @GET
        @Produces(MediaType.TEXT_PLAIN)
        public Response getVersion() {
          return Response.ok("Hello World").build();
        }
      }
      

       

      The integration test looks like this:

      @RunWith(Arquillian.class)
      @RunAsClient
      public class CcTestResourceIT {
      
      
        @Deployment
        public static Archive<?> createDeployment() {
          PomEquippedResolveStage pomFile = Maven.resolver().loadPomFromFile("pom.xml");
          WebArchive archive = ShrinkWrap.create(WebArchive.class)
              .addAsLibraries(pomFile.resolve("org.assertj:assertj-core").withTransitivity().asFile())
              .addClasses(JaxRsActivator.class, CcTestResource.class)
              .addAsResource("log4j2.xml")
              .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
          return archive;
        }
      
      
        @ArquillianResource
        private URL baseURI;
      
      
        @Test
        public void getArticlesByEan() throws Exception {
          Response response = ClientBuilder.newClient()
              .target(getCcTestResourceURI())
              .request(MediaType.TEXT_PLAIN)
              .get();
      
      
          assertThat(response.getStatusInfo()).isEqualTo(Status.OK);
        }
      
      
        private URI getCcTestResourceURI() throws URISyntaxException {
          return UriBuilder.fromUri(baseURI.toURI()).path("api").path("cc").build();
        }
      }
      

       

      The problem is: tests that use the ClientBuilder and @RunAsClient result in 0% coverage. When I remove @RunAsClient it works.

       

      Is there a way to keep @RunAsClient and use the ClientBuilder?

       

      Thanks in advance.