1 Reply Latest reply on Sep 29, 2013 10:02 AM by Rafael Pestano

    Mixed mode for test setup/execution

    Eldar Yusupov Newbie

      Hi, I have a test for a JAX-RS application where I want to be able to setup a database via JPA in an in-container mode and then perform the test itself via JAX-RS client in in-client mode.

      I imagined the test could be something like this (with testable attribute in @Deployment attribute set to true), but unsurprisingly it does not work:

          public void prepareForTests() throws Exception {
          public void cleanupAfterTests() throws Exception {
          public void shouldReturnValuesFromDB() throws URISyntaxException {
              Client client = ClientBuilder.newClient();
              String response = client.target(baseUrl.toURI()).path("test").request(MediaType.TEXT_PLAIN_TYPE).get(String.class);
              assertEquals("test", response);

      Is it possible to achieve this somehow? Are there other options to write a test like this with Arquillian?

      Thanks in advance!

        • 1. Re: Mixed mode for test setup/execution
          Rafael Pestano Novice

          Hi there,


          have you setup RestProvider? for testing in JbossAS i have this:



            public static void initClass() {

               //rest provider

              ResteasyProviderFactory providerFactory = ResteasyProviderFactory.getInstance();






            public void shouldBeAbleToQueryRestResource(@ArquillianResource URL contextPath) {

             ClientRequest request = new ClientRequest(contextPath+"rest/resource/");


             ClientResponse<String> response =  request.get(String.class);

             Assert.assertEquals(200, response.getStatus());



          my deployment is marked as testable=true.


          for more advanced client testing you may a look at Warp extension


          I hope that helps