6

I'm trying to wrap my head around Arquillian and am just not fundamentally understanding the difference between in-container mode vs. as-client mode.

My understanding is that, with Arquillian/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. Bonus points for providing a concrete code example (and not the vague ones straight from the Reference Guide!) that explain why/how you run the tests in both modes. Thanks in advance!

IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756

1 Answers1

2
  • in-container: use for white box, integration testing
  • as-client: use for black box, functional testing

i.e., for UI/functional testing ("as" the role of a "client" using the app in production) use as-client mode with @RunAsClient. For true integration testing (testing dependencies between classes where you need internal "white box" knowledge about the app itself), using in-container mode.

In both cases ShrinkWrap and Arquillian deploy your in-memory archive (JAR/WAR/EAR) directly to the configured container (via a JBoss-homegrown streaming protocol), however when tests are run in different modes they have different access to the container depending on the test mode.

IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
  • I understand the difference between whitebox and blackbox testing but i also do not quite get it with the client mode testing. does it mean that the shrinkwrapped archive in client mode is not deployed into the same app under test but is deployed into a separate app so that there is a client/server type config? if in client mode the shrinkwrap archive is also deployed into the app under test then i still do not see the difference between the two modes. :( – dragonsfire May 15 '15 at 13:40
  • Awesome, thanks, btw, "Fajã do Calhau is a supratidal talus-platform located on the South-East coast of São Miguel Island (Azores). Locally called “fajãs”, these flat platforms with hummocky surfaces result from landslides and are relatively common coastal features in the archipelago, occurring on the toe of the cliffed coasts of most Azorean islands.Fajã do Calhau is at the foot of a 380 m high cliff and has an area of approximately 220,000 m2, circa 1300 m length and maximum width of 260 m.", according to G. Lameiras et al. (2009), p.827 – Oleksii Kyslytsyn Jun 21 '18 at 12:21