Here is a review of Arquillian Testing Guide by John D. Ament published by Packt Publishing. Before I give my opinion of his book, let me first make a disclaimer. I am also a Packt Pub author. I am the author of the up and coming Java EE 7 Developer Handbook (September 2013).
Mr Ament expects you the developer to be familiar with Java EE 5 or 6, an enterprise developer in Java. I guess you should have about one or two year experience and therefore you should know how to write Java unit tests with JUnit (or TestNG), the book leans on JUnit. In the first, chapter, The Alien Have Landed; the author covers the basics of Arquillian Framework and it is helpful for engineers to have Apache Maven knowledge. Ament explains very well how to create a Maven project with Arquillian, and you find here hints and tips to avoid dependency download meltdown. The book’s first example is about building a Java project with an embedded container (so-called container-less build). Ament is clear about to set up a test project for re-use, creating different archive, JAR, WAR and EAR; and defining Maven profiles. It is an impressive start because when I writing my own Java EE 7 book, I wish that I had this information about an easy-to-read structure about integrating Arquillian.
The second chapter, Evolution of Testing digs deep in the history of Java enterprise testing and why we engineers must perform this duty in professional work place. Ament quickly guides the reader through jumps in technology from XDoclet to Mockito to HP QuickTest Professional. He also covers the Selenium and SoapUI toolkits briefly; and to a certain degree this text can treated as a handy reference to the background in testing. He covers the reasons where and how Arquillian can help to alleviate, extend these products and solve the nagging issues with these products in testing.
The real cherry berries for the contemporary Java EE engineer starts with chapter three, Container Testing; and this where the software developer does learn how to build integration tests with Arquillian Framework. The reader learns about different deployments and archives. Ament covers the Arquillian protocols in full detail. He obviously has tested Arquillian in many application servers in different configurations from JBoss AS 7 (rebranded recently to JBoss WildFly), GlassFish, Weld, OpenEJB, Jetty, TomEE and Tomcat. He has advice for Spring Framework developer too who want to use Arquillian in their applications. Ament particular does a fine job describing the merits of embedded versus managed and remote testing with Arquillian, because not all of the application servers, EJB container or servlet container are capable of support all of the Arquillian protocols and deployment capabilities. One of the great examples is the CDIDelegateTest that really helps the reader get the picture straightaway with no fuss.
Chapter four is called: Why Did the Test Fail? This chapter pays for the book itself. There is nothing worse than having a unit test or integration test fail, with or without Arquillian framework; and it is worst if you were not responsible for writing code in the first place. Ament has a lot of advice and descriptions on what could be cause for a failing Arquillian test. The text is particular relevant when you and your team are running Arquillian in continuous integration environment where the deployment is to a managed or remote server with other dependencies such a database. To finish, the chapter Ament provides a set of Dos and Don’ts sub sections.
The fifth chapter of book: Enriching the Enterprise Test Case, is about Arquillian and Context Dependency Injection, which I am a great fan of. Ament has nice examples and there is a fine explanation of CDI and JAX-RS testing for the request scope application. He covers also popular external CDI extensions and how to test features that use them very well. He even has a section on writing CDI extensions and testing there functionality with Arquillian, which is truly great stuff and a fantastic reference for advanced Java EE software developers. In this fifth chapter, also illustrates Arquillian Persistence extension with clear code and examples. This is hard-hat stuff that I figured out for myself whilst writing my own Java EE 7 book with Gradle and Arquillian test examples, and it is nice to see that Ament supplements and enhances my knowledge of the framework. If you want to find out how to test stateless EJB then you will find it here (and also in my Java EE 7 book).
There are ten chapters in this book and unfortunately I ran out time to review the rest of the book. The remaining content covers Arquillian extensions, including in-depth coverage of the Persistence and Transaction extensions, and running the framework with Spock with Groovy; Functional Application testing with Selenium and the Warp drive extension; web services testing; Arquillian and OSGI; and finally a full chapter dedicated to the underlying and central core framework ShrinkWrap, which allows developer to create a virtual Java archives.
Ament has written great book that concentrates on JBoss Arquillian Framework purely and simply. The book was written in the Java EE 6 timeframe just before next platform edition release, however the content is highly relevant still to all Java EE 7 developers. Ament has delivered a definitive guide to the Arquillian Framework. I wish that I had this book on my desk and Kindle application much earlier in my selfish task of writing about the sumptuous changes in new Java EE 7; and most of all I learnt how Arquillian can do a lot more than I what I thought it could.
Peter A. Pilgrim
Author of Java EE 7 Developer Handbook
Sunday, 2ndJune 2013
PS: An earlier text of this review has also been uploaded to Amazon.co.uk.