Java Reference
In-Depth Information
servlet containers such as Tomcat or Jetty. Here, we want to use WildFly so we will use an
appropriate container adapter. However, we have a few possible choices. Container ad-
apters can be divided into three basic groups:
Embedded : This is the mode in which a container is run on the same JVM in-
stance the tests are running. Often, a container run in this mode is not an original
one, but packed to a single JAR limited version.
Managed : In this mode, the real application server is run on a separate JVM. As
the name implies, it's possible to manage the state of the container, run it, stop it,
and so on. By default, when you run the test, the server is started, tests are run
against it, and then it is stopped. However, it is possible to configure Arquillian to
run tests on the already running instance.
Remote : In this mode, we just connect to some existing server instance and run
tests against it.
The most universal choice to run tests is the managed container. Tests are run on the real
server, same as on the production environment, and additionally, it is possible to manage
its state, allowing for some more advanced tests such as testing features related to high-
availability or communication between two applications that run on different instances.
Now, we need to add the appropriate container adapter to our pom.xml file. To do this,
we will create a Maven profile:
There might be situations in which you'd like to run tests against different application
servers. It's possible to just define a few Maven profiles and run tests a few times, each
time activating other profiles. Keep in mind that some application servers don't provide all
types of the adapters.
Search WWH ::

Custom Search