Automated testing has existed in some form for quite some time. Arquillian is a fairly new framework that has its roots around test-driven development and TCK validation for Java EE applications. Its use has grown into full-on application testing, supporting capabilities such as automatically seeding data to deploying to a large cluster of application servers.
Arquillian is a growing framework for automated testing of Java EE applications. Arquillian Testing Guide is meant to focus on how to use Arquillian to build automated test cases for your Java applications. We step through a large suite of the extensions available on top of Arquillian that you can add to your Maven-based projects to extend your testing capabilities.
This book starts with a quick drop into using Arquillian, and then navigates a little bit of testing history. We move on to Arquillian's container support and troubleshooting needs. We talk a lot about test enrichment strategies and capabilities that Arquillian adds to your test setup.
Chapter 1, The Aliens Have Landed!, helps us dive head first into Arquillian with some easy to read CDI examples. We go through the structure of an Arquillian enriched test case to understand what you'll see and where.
Chapter 2, The Evolution of Testing, shows that Arquillian has very deep roots in older test strategies and frameworks. We talk about some of these, how Arquillian grew from them, and how Arquillian can extend them.
Chapter 3, Container Testing, covers one of the key differences with Arquillian, its use of container deployments to execute tests. We go through the suite of these containers and how you may want to use them in your tests.
Chapter 4, Why Did the Test Fail?, explains how sometimes trying to figure out why something isn't passing can be difficult, even more when we have a full application server to deploy. This chapter will help you debug those tests.
Chapter 5, Enriching the Enterprise Test Case, goes through the built-in capabilities and when you can or cannot inject, as enrichment is how Arquillian provides injection support to your test case.
Chapter 6, Arquillian Extensions, builds upon the enrichment process; we look at some important extensions to Arquillian and alternative test runners.
Chapter 7, Functional Application Testing, focuses on the functional testing capabilities of Arquillian. We review Drone, Warp, and Graphene to show how to build out functional tests.
Chapter 8, Service Testing, focuses on service testing, such as EJBs, Soap Web Services, or REST APIs will be covered here.
Chapter 9, Arquillian and OSGi, focuses on how to use JBoss OSGi as your container runtime with Arquillian-based tests.
Chapter 10, ShrinkWrap in Action, illustrates how using Java code to create Java archives has never been as easy as when ShrinkWrap came to town.
To run the examples in the book, the following software will be required:
Maven:
Maven 3.0.3 or newer
IDE: (pick one)
Eclipse with m2eclipse plugin
Netbeans
IntelliJIDEA
Application servers:
Apache TomEE 1.5 or higher (preferably TomEE+)
JBoss AS 7.1.1 or higher
Sr no |
Software Name |
URL |
---|---|---|
1 |
Maven | |
2 |
Eclipse | |
3 |
Netbeans | |
4 |
IntelliJIDEA | |
5 |
TomEE | |
6 |
JBoss AS 7.1.1 | |
7 |
soapUI | |
8 |
Selenium |
This book is focused on developers and testers alike. Developers will find this book useful if they have previously worked with JUnit, are familiar with Java EE application development, and are interested in learning more about building more in-depth test cases.
Testers will find this book useful if they have used tools such as Selenium or soapUI to test their applications in an automated fashion and want to try a new tool. You'll learn some more about how to automatically deploy the applications that you test and use some additional tools to test more robustly.
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The @RunWith
annotation tells JUnit to use the Arquillian runner for running this class."
A block of code is set as follows:
@Test public void testCalculationOfBusinessData() { CalculatorData cd = new CalculatorData(1, 3, 5); CalculatorService ms = new CalculatorServiceImpl(); ms.calculateSum(cd); assertEquals(1 + 3 + 5, cd.getResult()); }
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
public class TestUtils {
public static JavaArchive createBasicJar() {
return ShrinkWrap.create(JavaArchive.class,"test.jar")
.addAsManifestResource(EmptyAsset.INSTANCE,"beans.xml")
.addPackages(false,getCorePackages());
}
Any command-line input or output is written as follows:
mvn clean install –Popenwebbeans-embedded-1
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: " If you click on Edit, the selected row will be shown".
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>
, and mention the book title via the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at <[email protected]>
if you are having a problem with any aspect of the book, and we will do our best to address it.