Java Reference
In-Depth Information
Getting started with Arquillian
Although Arquillian does not depend on a specific build tool, it is commonly used with
Maven; it offers dependency management and thus simplifies the task of including the
Arquillian libraries in the application since they are distributed in the Central Maven
repository.
Depending on the type of archetype you have used for generation, you might have a
different folder structure in your project; that is not an issue. What is really important
is that you provide the following structure under your
src
folder:
•
main/
•
java/
: Place all application Java source files here (under the
Java package)
•
resources/
: Place all application configuration files here
•
test/
•
java/
: Place all test Java source files here (under the Java
package)
•
resources/
: Place all test configuration files here (for ex-
ample,
persistence.xml
)
So by now, we will be working under
test/java
, which is where we will place our
first Arquillian test class.
Writing an Arquillian test
If you have been working with JUnit (
http://www.junit.org
), you will find an Arquillian
test very similar, just with some extra spice in it.
In order to do that, we will use Eclipse and Maven, just as we have done so far. If you
are about to add test classes to your project, there is obviously no need to create a
new project for this purpose. However, for learning purposes, we have delivered this
example in a separate project so that you can see exactly what to add in order to run
Arquillian tests.