Skip to end of metadata
Go to start of metadata

Using Arquillian, you write a basic test case and annotate it with declarative behavior that says, "@RunWith Arquillian." This declaration tells Arquillian to take over execution of the test when it's launched. That's when the real magic happens.

Launching an Arquillian test is as simple as right-clicking the test class in the IDE and selecting Run As > * Test (e.g., JUnit, TestNG, Spock, etc). Based on the classpath configuration, Arquillian starts or binds to the target container (JBoss AS, GlassFish, OpenEJB, etc) and deploys the test archive defined in the @Deployment method. The archive includes the test case along with the specified classes, resources and libraries. Your test then executes inside the container and enjoys all the same services as an application component. That means you get dependency and resource injection into the test, you can access EJBs, you can load a persistence unit, you can get a handle to a database connection, etc. (Arquillian also has a client run mode, which only deploys the test archive, not the test case). Arquillian then captures the test results and transports them back to the test runner for reporting.

Aside from a few extra declarations (i.e., @RunWith and @Deployment), an Arquillian test looks like any other unit test and launched like any other unit test.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Jan 22, 2014

    I got totally lost when I thought this page was supposed to tell me how Arquillian works and began an evening long googling session. I eventually found my ways back to this guide, but to a later chapter. If you want to know how Arquillian really works, click here:

    ..then click on "child pages" and chose your preferred topic =)