Arquillian is great but some apps would prefer to use maven failsafe plugin to do their integration tests. If all your tests are client tests you can simply start the container and deploy the app before the tests are executed (pre-integration-test phase) and undeploy/stop the container after the test (post-integration-test phase). If it is not you can still write a servlet to execute the tests on the server side…wait, you are redoing Arquillian so maybe something is wrong in this case ;).
It is generally complicated/long to configure because you need to find how to start your container then to deploy an application on it etc…boring.
The solution is quite easy if you want to test against TomEE: the tomee maven plugin of course!
It supports start/stop/deploy/undeploy goals but you generally don’t need all of them. All you need if you are writing your integration tests in the application module is to start the container (it will deploy automatically the app) and stop it.
The last important point is to be sure to wait the container is started before running tests (by default start goal is asynchronous). To do so, simply set to true checkStarted attribute.
Here is a sample:
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.superbiz</groupId> <artifactId>demoit</artifactId> <version>1.0-SNAPSHOT</version> <packaging>war</packaging> <!-- your dependencies, properties ... --> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>2.13</version> <executions> <execution> <goals> <goal>integration-test</goal> <goal>verify</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.openejb.maven</groupId> <artifactId>tomee-maven-plugin</artifactId> <version>1.6.0-SNAPSHOT</version> <executions> <execution> <id>start</id> <phase>pre-integration-test</phase> <goals> <goal>start</goal> </goals> <configuration> <checkStarted>true</checkStarted> </configuration> </execution> <execution> <id>stop</id> <phase>post-integration-test</phase> <goals> <goal>stop</goal> </goals> </execution> </executions> <configuration> <simpleLog>true</simpleLog> </configuration> </plugin> </plugins> </build> </project>