Arquillian Testing Guide

Arquillian Testing Guide

Language: English

Pages: 242

ISBN: 1782160701

Format: PDF / Kindle (mobi) / ePub

Get familiarized with the Arquillian framework and its capabilities to carry out integration and functional testing on a Java virtual machine


  • Build effective unit tests and integration using Arquillian and JUnit
  • Leverage Arquillian to test all aspects of your application – UI, SOAP and REST based applications
  • Run your tests the easy way using Arquillian in a container

In Detail

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.

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.

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.

What you will learn from this book

  • Develop automated tests using Arquillian and JUnit
  • Create tests using Selenium and then execute them paired with Arquillian Drone
  • Test using Arquillian Graphene to manipulate the DOM of your web applications
  • Learn how to use Arquillian and Spring to automatically wire an application context
  • Learn how to deploy your web services and test them automatically using Arquillian and soapUI


This book is a tutorial filled with plenty of code examples and strategies to give you many options when building your test structure.

Who this book is written for

This book is for developers and testers alike. Anyone who has worked with test driven development or building automated test cases will find use in this book. A reader should be familiar with some automation strategies and techniques such as JUnit and should have some exposure to techniques such as mocking.

Quantum Algorithms via Linear Algebra: A Primer

Cognitive Networked Sensing and Big Data

Principles of Quantum Computation and Information, Volume 1: Basic Concepts

Building Virtual Pentesting Labs for Advanced Penetration Testing

Building Virtual Pentesting Labs for Advanced Penetration Testing





















controlling side of this container, it will be the deployment we use for Arquillian. Switch the OpenEJB deployment with the OpenWebBeans deployment. Since OpenEJB supports EJBs, we want to test it out using an EJB. Therefore, assume the following EJB: @Stateless @LocalBean public class HelloLocalBean { private final String text = "Hello, World!"; public String getText() { return text; } } We can test it using the OpenEJB container based on the following test case: @RunWith(Arquillian.class)

also validate that the two calls to the get() method return different instances. Then we build test methods that call the CalculatorDelegate class to do the work. CalculatorDelegate tests out the Calculator object, both of which are CDI enabled. These methods are simple one-line methods – using the Instance object get a reference to a CalculatorDelegate class, then perform one of the test methods on that class. Other remote cases One of the topics that will be covered in a later chapter

embedded CDI containers. It won't work if you try to deploy it to a servlet container. The error you'll see is very obvious as well (again, taken from Tomcat 6 embedded): testEJBBootstrap(com.tad.arqdevguide.chp3.ejb.HelloLocalBeanTest) Time elapsed: 0.12 sec <<< ERROR! java.lang.IllegalArgumentException: ArquillianServletRunner not found. Could not determine ContextRoot from ProtocolMetadata, please contact DeployableContainer developer. at

you can inject a remote InitialContext to perform lookups against. For TomEE, you can inject a URL to the deployment and use that information to construct the initial context. Here is how to do it with TomEE: @RunWith(Arquillian.class) @RunAsClient public class RemoteDatabaseIntegratorTest { @Deployment(testable=false) public static JavaArchive createTestArchive() { return ShrinkWrap.create(JavaArchive.class,"test.jar")

cases / Remote testing use cases structuring / Structuring the remote test case other cases / Other remote cases tools / Remote testing tools power / The power of remote testing non testable deployments / Non-testable deployments Resource Adapters (RARs) / ShrinkWrap – building your own app resourcesadding, to archives / Adding resources REST APIsand soapUI / soapUI and REST APIs REST testsabout / Other REST tests HTTP client testing / HTTP client testing

Download sample


About admin