You are previewing Arquillian Testing Guide.
O'Reilly logo
Arquillian Testing Guide

Book Description

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.

    Table of Contents

    1. Arquillian Testing Guide
      1. Table of Contents
      2. Arquillian Testing Guide
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. The Aliens Have Landed!
        1. The progression of testing
        2. What is Arquillian
          1. The Arquillian difference
          2. The fundamentals of a test case
          3. Testing profiles
          4. Categorizing your test cases
          5. Enriching your tests
          6. Running out of the container
          7. Efficient test authoring
          8. ShrinkWrap – building your own app
          9. Getting the most from Arquillian
          10. Arquillian extensions
        3. Summary
      9. 2. The Evolution of Testing
        1. How did we get here?
          1. J2EE, in the beginning
          2. Manual testing patterns
          3. XDoclet – the component revolution
        2. A jump in technology
          1. Mocking
            1. Still missing something
          2. OpenEJB, the embedded EJB container
          3. Servlet containers
          4. Spring TestContext
          5. Selenium – functional testing
          6. QuickTest Professional
          7. soapUI
          8. Deployment
        3. Summary
      10. 3. Container Testing
        1. Containers and deployments
          1. Deployments
          2. Protocols
          3. The embedded container
            1. Running the containers
            2. Weld SE and EE
            3. OpenWebBeans
            4. OpenEJB
            5. Jetty
            6. Apache Tomcat
            7. Mix and match patterns
            8. Apache TomEE
            9. GlassFish 3.1
            10. JBoss AS 6.x
            11. Honorable mentions
              1. Arquillian Daemon Server
              2. Spring
              3. JPA/Hibernate
            12. Embedded container summary
          4. Managed containers
            1. JBoss containers
              1. JBoss AS 7.1
              2. Older containers – AS 5.1 and AS 6
            2. GlassFish 3.1
            3. Tomcat
            4. Managed container summary
          5. Remote containers
            1. Tomcat
              1. Tomcat 6
            2. JBoss
              1. Legacy JBoss – 4.x, 5.x, and 6.x
              2. JBoss AS 7
            3. GlassFish
              1. GlasshFish 3.x
            4. WebLogic
              1. WebLogic 10g
              2. WebLogic 12c
            5. Apache TomEE
              1. TomEE 1.0/1.5
            6. Cloud deployments
              1. Cloudbees
          6. Remote testing strategy
            1. Remote testing use cases
            2. Structuring the remote test case
            3. Other remote cases
          7. Remote testing tools
            1. Deploying to multiple containers
            2. The power of remote testing
              1. Non-testable deployments
          8. Remote container summary
          9. Container comparison
            1. Tomcat
            2. Apache TomEE
            3. JBoss
              1. Pre-JBoss 6
              2. JBoss AS 6
              3. JBoss AS 7
            4. GlassFish
            5. Cloud containers
              1. CloudBees
              2. OpenShift
            6. WebLogic
            7. Other setups – the embedded applications
            8. Unofficial containers
        2. Summary
      11. 4. Why Did the Test Fail?
        1. Running your tests – the downside
          1. The frustration
          2. Packaging structure
            1. The wrong type of archive
            2. The container-specific descriptor
            3. Wrong package version
          3. The hard hat area
            1. Sharing resources
            2. Hello, are you listening?
            3. Watch out for falling bugs
          4. Problems starting up
            1. The ports are working against you
            2. You need a container
              1. No container? No problem!
            3. Consulting the remote server
          5. Managing your test runtimes
            1. Make it compile
            2. Set up your profiles for long term
            3. Overlapping profiles
          6. The dos and don'ts
            1. Embedded container dos and don'ts
            2. Managed containers dos and don'ts
            3. Remote container dos and don'ts
        2. Summary
      12. 5. Enriching the Enterprise Test Case
        1. Testing the dependency injection
          1. CDI injection – simplicity in action
            1. Testing external extensions
            2. Building and testing extensions
          2. EJB and resource injection
            1. Special considerations for EJB deployments
            2. Testing persistence
            3. Testing Session beans
            4. Working with Remote Session Beans
        2. Failure scenarios
          1. Dependency failures
        3. Introduction to Arquillian extensions
          1. Framework extensions
          2. Spring
            1. Arquillian versus Spring test
        4. Summary
      13. 6. Arquillian Extensions
        1. Extending Arquillian
        2. Testing against a database using JPA
          1. The Persistence Extension
            1. Preloading the database
            2. Validate and clean up your database
          2. Mix and match
        3. The transaction extension
        4. Multiple artifacts
          1. Creating EARs
            1. JaCoCo and Arquillian – code coverage
          2. Deploying dependencies
        5. Spock, very groovy test writing
        6. Summary
      14. 7. Functional Application Testing
        1. Functional testing
          1. Functional testing using Selenium
            1. Consider the approach
            2. Test Driven Development
          2. Simplifying the test case
            1. Page delegate pattern
          3. Warp drive
            1. Phases
            2. Grouping requests
            3. Spring MVC and Warp
          4. Rich application testing with Graphene
            1. Captures
            2. Selectors and interactions
        2. Summary
      15. 8. Service Testing
        1. Service testing approaches
          1. Web service stubs
          2. Application invocation
          3. Compare and contrast
          4. Using soapUI
            1. soapUI and Arquillian
            2. soapUI and REST APIs
          5. Other REST tests
            1. HTTP client testing
          6. Testing JMS
          7. Testing Seam 2
        2. Summary
      16. 9. Arquillian and OSGi
        1. OSGi and Arquillian
          1. What is OSGi?
          2. JBoss OSGi
          3. OSGi versus everything else
            1. OSGi versus JBoss Modules
          4. Working with OSGi in a test case
            1. ShrinkWrap Assets
            2. OSGi archives
            3. Testing a deployed service
          5. Life outside of OSGi embedded
            1. Testing Java EE using OSGi
            2. Multiple deployment scenarios
          6. OSGi support in GlassFish
        2. Summary
      17. 10. ShrinkWrap in Action
        1. What is ShrinkWrap?
          1. Creating archives
          2. Adding resources
            1. Assets
        2. Managing libraries and modules
          1. More on building EARs
          2. ShrinkWrap resolver
          3. Importing modules
          4. Deployment descriptors
            1. Importing descriptors
            2. Deploying descriptors
          5. A complex use case
        3. Summary
      18. Index