I'm trying to wrap my head around Arquilian and am just not fundamentally understanding the difference between in-container mode vs. as-client mode. My understanding is that, with Arquilian/ShrinkWrap:
- You create an archive that only contains the components you want to integrate and test with
- You stream this in-memory archive to an actual container (deploying it)
- You run the archive as a test inside the container
- You make an assertion about what will happen as a result of that test
So, from my perspective, everything just "feels" like it would always be in-container, since the tests are always executing inside a container.
Please help me understand the differences between these two modes and what types of integration tests both modes are suited for. A concrete code example that explains why/how you run the tests in both modes would be enormously appreciated! Thanks in advance!
your description fits exactly in-container mode (plus your test class and additional arquillian modules such as enrichers for EJB etc will be deployed to the server as well).
When it comes to client mode, you deploy your shrinkwrap test archive (without repackaging as it's the case for in-container testing), but tests are performed from your local jvm (outside of the container in remote way).
More information can be found in our confluence space - https://docs.jboss.org/author/display/ARQ/Test+run+modes
I hope that helps.
So, to summarize:
- in-container: Arquillian simulates the container you describe/configure it with, repackages your code (somehow), and then runs your code right from inside your IDE (Eclipse in my case); but
- as-client: Arquillian uses ShrinkWrap to bundle up an archive (JAR/WAR/EAR) and deploy it to a remote container
Is this the gist of it or am I missing something here? Please understand I have already read the "Test run modes" page that you cited and am still having a tough time "seeing the forest through the trees" here! Thanks again!
You are welcome.
Just to clarify.
in-container mode: Arquillian deploys your Shrinkwrap archive together with some additions (namely extensions you are using or which your container adapter relies on) to your target environment (through container adapter such as JBoss, Tomcat, Websphere to name a few). Then it runs your tests within this environment, collects the result and send them back to your test runner - could be IDE or a build tool (such as mvn's surefire).
as-client mode: Arquillian deploys your test archive and runs tests locally talking with your target environment from outside (local jvm)
I hope this gives you slightly better picture