Arquillian – Very first best practice

During usage of Arquillian I figured out some things that could be a starting point for best practices when testing with Arquillian.

In my application I had some defaults that I have to do every time, when I would like to implement a new test.

  1. Add logging
  2. Add persistence.xml
  3. For different domains, add all classes that belongs to the entity graph
  4. Setting up the name of the web-archive properly
  5. Introduces maven dependency lookup

In my opinion, it’s very handy to implement a helper class with the builder pattern, that creates

  1. a ShrinkWrap of type WebArchive with the given name
  2. has methods that fulfills the above requirements.

The impact on our testclasses was tremendous, we improved the readability and reduces the code duplication.

So long story short:

Introduce archive builder that encapsulates common patterns and combination of classes.

2 Kudos

Leave a Reply

Your email address will not be published. Required fields are marked *