Book Image

Arquillian Testing Guide

By : John D. Ament
Book Image

Arquillian Testing Guide

By: John D. Ament

Overview of this book

<p>Integration testing sometimes involves writing complex codes. This book introduces you to the capabilities of Arquillian to enable you to write simple code with a broad range of integration tests for java applications. <br /><br />Arquillian Testing Guide serves as an introductory book to writing simple codes for testing java applications. This book will help you to develop richer test cases which can be run automatically while performing rigorous testing of the software. <br /><br />Arquillian Testing Guide introduces you to Arquillians features and capabilities. This book will help you understand the mechanism of creating deployments and test against those deployments. The book begins with basic JUnit test cases beginning with an enterprise test case, which then go on to discuss remote testing. During the course of the book, you will also learn how to mix container and non-container tests into a single test case. By the end of the book, you will have learned how to extend JUnit tests to work with Arquillian and deploy them to a container automatically.</p>
Table of Contents (17 chapters)

Managing libraries and modules


Usually, if you're building a web application, you'll have some kind of library that you use. Whether it's a large framework such as Spring or Hibernate, or something more refined such as PrimeFaces or Apache Commons Email, you'll need to bring in some set of JAR files to your web application.

One way to add these libraries to your application is to use the relative path. Take a look at this code snippet:

public File[] getWebInfLibs() {
  File dir = new File("target/my-app/WEB-INF/lib");
  return dir.listFiles();
}

Assuming that you are using Maven, this will give you all files that were in your exploded directory's WEB-INF/lib directory. These files do get copied in place early enough in the build that they should be available during testing. Although, there may be reasons you only want certain files. You can manually choose each file from here and only install the files you want; however, ShrinkWrap has a more fluent API that better matches to your Maven build...