Skip to content

Why Arquillian?

January 28, 2011

Arquillian, a container-oriented testing framework layered atop TestNG and JUnit, brings your test to the runtime rather than requiring you to manage the runtime from your test. Picking up where unit tests leave off, Arquillian enables you to test real components that rely on real enterprise services in a real runtime.

Two major scopes:

  1. you can write integration tests just as you would a unit test and
  2. the test is portable to multiple environments (containers)

Quick view at its architecture:

Interesting things about Arquillian:

In Arquillian, each test case can control its own run mode. There are two modes in which you can test your code:

  • in-container (in-process invocation)
  • client (through a remote client)

Arquillian provides the following injections into fields or method arguments in Java EE containers:

  • @Inject (supported in any CDI environment)
  • @Resource
  • @PersistenceUnit
  • @PersistenceContext
  • @EJB

And what about ShrinkWrap?

The test case is dispatched to the container’s environment through coordination with ShrinkWrap, which is used to declaratively define a custom Java EE archive that encapsulates the test class and its dependent resources. Arquillian packages the ShrinkWrap-defined archive at runtime and deploys it to the target container. It then negotiates the execution of the test methods and captures the test results using remote communication with the server. Finally, Arquillian undeploys the test archive. We’ll go into more detail about how Arquillian works in a later chapter.

Why use Arquillian with Seam (2.x)?

Someone asked: We’d love to see Arquillian works with Seam 2.2.0 because the project we’re working on use java6, therefore can’t use SeamTest with TestNG. We end up have to inject all dependencies manually and do mockups for intergration testing which is a pain to write and can’t do the level of test we want, such as transaction and conversation related tests.

While Arquillian is ready for Seam 3, good news are that Michael S. is working hard on integrating it with Seam 2: https://issues.jboss.org/browse/ARQ-347

Advertisements

From → Arquillian, JBoss

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: