Theme: 
:imagesdir: images = Test your rest endpoints inside the container (ArqTip #1) Since http://arquillian.org/blog/2015/09/02/arquillian-core-1-1-9-Final/[Arquillian 1.1.9.Final^] it is possible to get deployment URL even in *in-container tests*. This enables REST endpoints testing inside the container. The main advantage of running this kind of test inside the container (same JVM) is that you can call any service/method of your application before making the (test)rest call. Even better, you can prepare your database or whatever configuration you need before running the test. Here is an example using arquillian persistence (which doesn’t work outside the container – see https://issues.jboss.org/browse/ARQ-1077[Arq1077^]): [source,java] ---- @RunWith(Arquillian.class) public class CrudRestIt { @Deployment(name = "cdi-rest.war") public static Archive createDeployment() { WebArchive war = Deployments.getBaseDeployment(); MavenResolverSystem resolver = Maven.resolver(); war.addAsLibraries(resolver.loadPomFromFile("pom.xml").resolve("com.jayway.restassured:rest-assured").withTransitivity().asFile()); war.addAsLibraries(resolver.loadPomFromFile("pom.xml").resolve("com.google.code.gson:gson:2.4").withoutTransitivity().asSingleFile()); System.out.println(war.toString(true)); return war; } @ArquillianResource URL basePath; @Test @UsingDataSet("car.yml") public void shouldListCars() { given(). queryParam("start", 0).queryParam("max", 10). when(). get(basePath + "rest/cars"). then(). statusCode(Status.OK.getStatusCode()). body("", hasSize(4)).//dataset has 4 cars body("model", hasItem("Ferrari")). body("price", hasItem(2450.8f)). body(containsString("Porche274")); } } ---- NOTE: I have included two libs into the deployment, RestAssured and Gson because both are used inside the test. As a bonus you can get code coverage of your REST endpoints, something you don’t have when running as client (testable=false a.k.a blackbox): image::cov.png[] image::cov2.png[] For any feedback and comments, see the original post: https://rpestano.wordpress.com/2015/11/08/test-your-rest-endpoints-inside-the-container-arqtip-1/.