SlideShare une entreprise Scribd logo
1  sur  41
Télécharger pour lire hors ligne
Real Java EE Testing with
Arquillian and ShrinkWrap


                            Don't fake it!




Dan Allen
Senior Software Engineer
JBoss, by Red Hat
Who am I?

    ●   Author of Seam in Action, Manning 2008
    ●   Seam Community Liaison
    ●   Weld, Seam & Arquillian project member
    ●   JSR-314 (JSF 2) EG representative
    ●   Open Source advocate



                                                                           mojavelinux



2                  Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Agenda                                                           #testrevolution

    ●   Testing, what's the problem?
    ●   Integration testing challenges
    ●   A component model for tests
    ●   ShrinkWrap
    ●   Arquillian
    ●   Case study




3                    Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Why don't we test?




4   Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
5   Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Common integration testing challenges

    ●   Active mocks to stand in for collaborators
    ●   Configure application to use test data source(s)
    ●   Deal with (lack of) classpath isolation
    ●   Run a build to create/deploy application archive




6                    Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Skip the Build!
                                                         Test in-container!




7   Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
container

    n. manages a runtime environment and provides resources,
    a component model and a set of services




8               Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
A component
                                                         model for tests




9   Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Unit tests vs integration tests

 Unit                                                 Integration
     ●   Fine-grained                                  ●   Coarse-grained
     ●   Simple                                        ●   Complex
     ●   Test single API call                          ●   Test intricate web of calls
     ●   Fast, fast, fast                              ●   Sloooooooow
     ●   Easily run in an IDE                          ●   Run in an IDE? How?




10                     Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Testing bandgap and compounding effort




                                                                                    Functional complexity

                                                                                    Thought and effort




     Unit Tests                 Integration Tests                           Functional Tests


11                Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Testing continuum with Arquillian




                                                                                    Functional complexity

                                                                                    Thought and effort




     Unit Tests                 Integration Tests                           Functional Tests


12                Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
In-container approach to integration testing

     ●   Separate container process
     ●   Test deployed as archive
     ●   Test runs in-container
     ●   Results collected remotely




13                   Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Weighing in-container testing

 Pros                                              Cons
     ●   Rely on shared memory                      ●   Lack of isolation
     ●   Pass-by-reference                          ●   Environment not “true”
     ●   Don't need remote views
     ●   Managed concurrency




14                  Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Don't tie your tests to a build!

     ●   Extra, external setup
     ●   Adds time to tests
     ●   Coarse-grained packaging




15                   Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
n. a simple, Apache-licensed Java API for assembling archives
     like JARs, WARs, EARs; developed by the JBoss Community




16             Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Benefits of ShrinkWrap

     ●   IDE incremental compilation
          ●   Save and re-run
          ●   Skip the build!
     ●   Simple API
     ●   Tooling views
     ●   Export and debugging
     ●   Micro-deployments




17                      Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Fluent archive creation
     final JavaArchive archive = ShrinkWrap.create("slsb.jar", JavaArchive.class)
         .addClasses(Greeter.class, GreeterBean.class);
     System.out.println(archive.toString(true));


 Yields output:
     slsb.jar:
     /com/
     /com/acme/
     /com/acme/app/
     /com/acme/app/ejb3/
     /com/acme/app/ejb3/Greeter.class
     /com/acme/app/ejb3/GreeterBean.class




18                       Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Architecture overview




19          Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
n. a simple, Apache-licensed test harness that abstracts away
     container lifecycle and deployment from test logic so developers
     can easily develop a broad range of integration tests for their
     enterprise Java applications; developed by the JBoss Community




20             Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
The mission of the Arquillian project is to...




          Make integration testing a breeze!




21           Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Prove it!
     @RunWith(Arquillian.class)
     public class GreeterTestCase {
      @Deployment
      public static JavaArchive createTestArchive() {
        return ShrinkWrap.create("test.jar", JavaArchive.class)
          .addClasses(Greeter.class, GreeterBean.class);
      }

         @EJB private Greeter greeter;

         @Test
         public void shouldBeAbleToInjectEJB() throws Exception {
           assertEquals("Hello, Earthlings", greeter.greet("Earthlings"));
         }
     }


22                          Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Arquillian guts the plumbing

     ●   Manages lifecycle of container
          ●   start/stop
          ●   bind/unbind
     ●   Enriches test class (e.g, @Inject, @EJB, @Resource)
     ●   Bundles test archive
          ●   code under test
          ●   libraries
          ●   test class and invoker (in-container run mode only)
     ●   Negotiates deployment of test archive
     ●   Captures test results and failures
23                         Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Benefits of Arquillian

     ●   Write less (test) code
     ●   As much or as little “integration” as you need
     ●   Looks like a unit test, get fully functioning components
     ●   Simple way to get an instance of component under test
     ●   You don't hesitate when you need a resource
     ●   Same test, multiple containers
     ●   It's the real deal!




24                     Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Test frameworks




           JUnit                                     TestNG
              >= 4.6                                        >= 5.10




25         Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Test archives

     ●   Built using ShrinkWrap API
     ●   Bundle:
          ●   code under test
          ●   dependent Libraries
          ●   test class and invoker (in-container run mode only)
     ●   Deployed to container before test is executed
     ●   Undeployed after test is executed




26                      Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Build, what build?
     @Deployment
     public static JavaArchive createTestArchive() {
       return ShrinkWrap.create("test.jar", JavaArchive.class)
         .addClasses(Greeter.class, GreeterBean.class);
     }




27                       Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Skip the build!
     @Deployment
     public static JavaArchive createTestArchive() {
       return ShrinkWrap.create("test.jar", JavaArchive.class)
         .addPackage(TranslateController.class.getPackage())
         .addManifestResource(
           new ByteArrayAsset("<beans/>".getBytes()),
           ArchivePaths.create("beans.xml"));
     }




28                       Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Micro deployments

     ●   Deploy components in isolation
     ●   Test one slice at a time
     ●   Don't need to wait for full application build/startup
     ●   Tune size of integration
          ●   Layers by inclusion
          ●   No “big bang”




29                      Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Containers

     ●   Mode
     ●   Capability




30                    Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Container modes

     ●   Embedded
         ●   Same JVM as test runner
         ●   Tests executed by native test runner
         ●   Lifecycle controlled by Arquillian
     ●   Remote
         ●   Separate JVM from test runner
         ●   Tests executed over remote protocol
         ●   Arquillian likely binds to ports




31                      Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Container capabilities

     ●   Java EE application server (JBoss AS, GlassFish, etc)
     ●   Servlet container (Tomcat, Jetty)
     ●   Managed bean container (Weld SE, Spring)
     ●   OSGi
     ●   SPI allows you to introduce any other container




32                   Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Not just for Java EE
     public interface DeployableContainer {

         void setup(Context context, Configuration configuration);

         void start(Context context) throws LifecycleException;

         ContainerMethodExecutor deploy(Context context, Archive<?> archive)
            throws DeploymentException;

         void undeploy(Context context, Archive<?> archive)
            throws DeploymentException;

         void stop(Context context) throws LifecycleException;

     }


33                         Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Test enrichment

     ●   Injection
          ●   Fields & method arguments
          ●   @Inject, @Resource, @EJB, etc.
     ●   Contexts
          ●   Request & Conversation  Test method
          ●   Session  Test class
          ●   Application  Test class
     ●   Interceptors & decorators



34                      Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Test run modes

     ●   In-container
          ●   Test bundled in @Deployment archive
          ●   Archive deployed to container
          ●   Test runs inside container with code under test
          ●   Test invokes code under test directly (same JVM)
     ●   Local
          ●   @Deployment archive unmodified
          ●   Archive deployed to the container
          ●   Test runs in original test runner
          ●   Test interacts as a remote client (e.g., HTTP client)

35                       Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
In-container testing MDBs: A case study

     ●   Asynchronous
          ●   How will client know server is done processing?
          ●   Thread.sleep() is prone to transient failures
     ●   No return value
          ●   How do we check post-conditions?


     ●   In-container == same JVM
          ●   Gives test control
          ●   Allows test to inspect contexts


36                      Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Arquillian is...

     ●   an innovative approach to testing
     ●   a component model for tests
     ●   test infrastructure & plumbing
     ●   a set of container implementations
     ●   a little bit of magic ;)




37                     Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
JBoss Testing Initiative

     ●   Comprehensive testing tool “stack”
     ●   Establish a testing culture in Java EE
          ●   #jbosstesting on irc.freenode.net
     ●   Filling voids
          ●   ShrinkWrap – Programmatic archive creation
          ●   Arquillian – Managed integration testing
          ●   Placeebo – Mock Java EE API implementations
          ●   JSFUnit – Gray-box JSF testing
          ●   Contribute to the unit testing frameworks?


38                       Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Get Involved!

     ●   Active and open community
     ●   How to contribute:
          ●   Ideas on forums or IRC
          ●   Feedback on releases – still in alpha!
          ●   Enhancements and bug fixes – we love patches!
          ●   Documentation
          ●   Blogs – share your stories!
     ●   Come meet us:
          ●   http://jboss.org/arquillian
          ●   #jbosstesting on irc.freenode.net

39                       Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
http://jboss.org/arquillian




40                 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
Q&A                  http://jboss.org/arquillian
                     http://jboss.org/shrinkwrap




Dan Allen
Senior Software Engineer
JBoss, by Red Hat

Contenu connexe

Tendances

September 2010 - Arquillian
September 2010 - ArquillianSeptember 2010 - Arquillian
September 2010 - ArquillianJBug Italy
 
Testing Spring Boot Applications
Testing Spring Boot ApplicationsTesting Spring Boot Applications
Testing Spring Boot ApplicationsVMware Tanzu
 
Testing with Spring: An Introduction
Testing with Spring: An IntroductionTesting with Spring: An Introduction
Testing with Spring: An IntroductionSam Brannen
 
Create an architecture for web test automation
Create an architecture for web test automationCreate an architecture for web test automation
Create an architecture for web test automationElias Nogueira
 
Prod-Like Integration Testing for Distributed Containerized Applications
Prod-Like Integration Testing for Distributed Containerized ApplicationsProd-Like Integration Testing for Distributed Containerized Applications
Prod-Like Integration Testing for Distributed Containerized ApplicationsVMware Tanzu
 
Testing Web Apps with Spring Framework
Testing Web Apps with Spring FrameworkTesting Web Apps with Spring Framework
Testing Web Apps with Spring FrameworkDmytro Chyzhykov
 
How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)Dave Haeffner
 
JavaLand - Integration Testing How-to
JavaLand - Integration Testing How-toJavaLand - Integration Testing How-to
JavaLand - Integration Testing How-toNicolas Fränkel
 
Testing Java Web Apps With Selenium
Testing Java Web Apps With SeleniumTesting Java Web Apps With Selenium
Testing Java Web Apps With SeleniumMarakana Inc.
 
Hadoop Summit 2013 : Continuous Integration on top of hadoop
Hadoop Summit 2013 : Continuous Integration on top of hadoopHadoop Summit 2013 : Continuous Integration on top of hadoop
Hadoop Summit 2013 : Continuous Integration on top of hadoopWisely chen
 
Spring Framework 3.2 - What's New
Spring Framework 3.2 - What's NewSpring Framework 3.2 - What's New
Spring Framework 3.2 - What's NewSam Brannen
 
API Testing following the Test Pyramid
API Testing following the Test PyramidAPI Testing following the Test Pyramid
API Testing following the Test PyramidElias Nogueira
 
Automated Testing in Angular Slides
Automated Testing in Angular SlidesAutomated Testing in Angular Slides
Automated Testing in Angular SlidesJim Lynch
 
Riga Dev Day - Automated Android Continuous Integration
Riga Dev Day - Automated Android Continuous IntegrationRiga Dev Day - Automated Android Continuous Integration
Riga Dev Day - Automated Android Continuous IntegrationNicolas Fränkel
 
Monitoring Akka with Kamon 1.0
Monitoring Akka with Kamon 1.0Monitoring Akka with Kamon 1.0
Monitoring Akka with Kamon 1.0Steffen Gebert
 
Testing with JUnit 5 and Spring
Testing with JUnit 5 and SpringTesting with JUnit 5 and Spring
Testing with JUnit 5 and SpringVMware Tanzu
 
Testing with laravel
Testing with laravelTesting with laravel
Testing with laravelDerek Binkley
 

Tendances (20)

Test Dependencies and the Future of Build Acceleration
Test Dependencies and the Future of Build AccelerationTest Dependencies and the Future of Build Acceleration
Test Dependencies and the Future of Build Acceleration
 
September 2010 - Arquillian
September 2010 - ArquillianSeptember 2010 - Arquillian
September 2010 - Arquillian
 
Testing Spring Boot Applications
Testing Spring Boot ApplicationsTesting Spring Boot Applications
Testing Spring Boot Applications
 
Testing with Spring: An Introduction
Testing with Spring: An IntroductionTesting with Spring: An Introduction
Testing with Spring: An Introduction
 
Integration testing - A&BP CC
Integration testing - A&BP CCIntegration testing - A&BP CC
Integration testing - A&BP CC
 
Create an architecture for web test automation
Create an architecture for web test automationCreate an architecture for web test automation
Create an architecture for web test automation
 
Prod-Like Integration Testing for Distributed Containerized Applications
Prod-Like Integration Testing for Distributed Containerized ApplicationsProd-Like Integration Testing for Distributed Containerized Applications
Prod-Like Integration Testing for Distributed Containerized Applications
 
Unit testing - A&BP CC
Unit testing - A&BP CCUnit testing - A&BP CC
Unit testing - A&BP CC
 
Testing Web Apps with Spring Framework
Testing Web Apps with Spring FrameworkTesting Web Apps with Spring Framework
Testing Web Apps with Spring Framework
 
How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)
 
JavaLand - Integration Testing How-to
JavaLand - Integration Testing How-toJavaLand - Integration Testing How-to
JavaLand - Integration Testing How-to
 
Testing Java Web Apps With Selenium
Testing Java Web Apps With SeleniumTesting Java Web Apps With Selenium
Testing Java Web Apps With Selenium
 
Hadoop Summit 2013 : Continuous Integration on top of hadoop
Hadoop Summit 2013 : Continuous Integration on top of hadoopHadoop Summit 2013 : Continuous Integration on top of hadoop
Hadoop Summit 2013 : Continuous Integration on top of hadoop
 
Spring Framework 3.2 - What's New
Spring Framework 3.2 - What's NewSpring Framework 3.2 - What's New
Spring Framework 3.2 - What's New
 
API Testing following the Test Pyramid
API Testing following the Test PyramidAPI Testing following the Test Pyramid
API Testing following the Test Pyramid
 
Automated Testing in Angular Slides
Automated Testing in Angular SlidesAutomated Testing in Angular Slides
Automated Testing in Angular Slides
 
Riga Dev Day - Automated Android Continuous Integration
Riga Dev Day - Automated Android Continuous IntegrationRiga Dev Day - Automated Android Continuous Integration
Riga Dev Day - Automated Android Continuous Integration
 
Monitoring Akka with Kamon 1.0
Monitoring Akka with Kamon 1.0Monitoring Akka with Kamon 1.0
Monitoring Akka with Kamon 1.0
 
Testing with JUnit 5 and Spring
Testing with JUnit 5 and SpringTesting with JUnit 5 and Spring
Testing with JUnit 5 and Spring
 
Testing with laravel
Testing with laravelTesting with laravel
Testing with laravel
 

En vedette

Understanding QA Kampala
Understanding QA KampalaUnderstanding QA Kampala
Understanding QA KampalaThoughtworks
 
Future of Testing, Test Automation and The Quality Analyst
Future of Testing, Test Automation and The Quality AnalystFuture of Testing, Test Automation and The Quality Analyst
Future of Testing, Test Automation and The Quality AnalystAnand Bagmar
 
Java EE Arquillian Testing with Docker & The Cloud
Java EE Arquillian Testing with Docker & The CloudJava EE Arquillian Testing with Docker & The Cloud
Java EE Arquillian Testing with Docker & The CloudBruno Borges
 
Say NO To (More) Selenium Tests
Say NO To (More) Selenium TestsSay NO To (More) Selenium Tests
Say NO To (More) Selenium TestsAnand Bagmar
 
Testes de Software & Ferramentas de Testes
Testes de Software & Ferramentas de TestesTestes de Software & Ferramentas de Testes
Testes de Software & Ferramentas de TestesPaulo César M Jeveaux
 
vodQA Pune - Innovations in Testing - Agenda
vodQA Pune - Innovations in Testing - AgendavodQA Pune - Innovations in Testing - Agenda
vodQA Pune - Innovations in Testing - AgendavodQA
 
Tests d'intégration avec Arquillian
Tests d'intégration avec ArquillianTests d'intégration avec Arquillian
Tests d'intégration avec ArquillianAlexis Hassler
 

En vedette (9)

Understanding QA Kampala
Understanding QA KampalaUnderstanding QA Kampala
Understanding QA Kampala
 
Future of Testing, Test Automation and The Quality Analyst
Future of Testing, Test Automation and The Quality AnalystFuture of Testing, Test Automation and The Quality Analyst
Future of Testing, Test Automation and The Quality Analyst
 
What is WAAT?
What is WAAT?What is WAAT?
What is WAAT?
 
Java EE Arquillian Testing with Docker & The Cloud
Java EE Arquillian Testing with Docker & The CloudJava EE Arquillian Testing with Docker & The Cloud
Java EE Arquillian Testing with Docker & The Cloud
 
Say NO To (More) Selenium Tests
Say NO To (More) Selenium TestsSay NO To (More) Selenium Tests
Say NO To (More) Selenium Tests
 
Testes de Software & Ferramentas de Testes
Testes de Software & Ferramentas de TestesTestes de Software & Ferramentas de Testes
Testes de Software & Ferramentas de Testes
 
vodQA Pune - Innovations in Testing - Agenda
vodQA Pune - Innovations in Testing - AgendavodQA Pune - Innovations in Testing - Agenda
vodQA Pune - Innovations in Testing - Agenda
 
Tests d'intégration avec Arquillian
Tests d'intégration avec ArquillianTests d'intégration avec Arquillian
Tests d'intégration avec Arquillian
 
Agile QA Process
Agile QA ProcessAgile QA Process
Agile QA Process
 

Similaire à Real Java EE Testing with Arquillian and ShrinkWrap

Throwing complexity over the wall: Rapid development for enterprise Java (Jav...
Throwing complexity over the wall: Rapid development for enterprise Java (Jav...Throwing complexity over the wall: Rapid development for enterprise Java (Jav...
Throwing complexity over the wall: Rapid development for enterprise Java (Jav...Dan Allen
 
Jakarta EE Test Strategies (2022)
Jakarta EE Test Strategies (2022)Jakarta EE Test Strategies (2022)
Jakarta EE Test Strategies (2022)Ryan Cuprak
 
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...Peter Pilgrim
 
Arquillian 소개
Arquillian 소개Arquillian 소개
Arquillian 소개성욱 전
 
테스트 어디까지 해봤니? Arquillian을 이용한 Real Object 테스트
테스트 어디까지 해봤니? Arquillian을 이용한 Real Object 테스트테스트 어디까지 해봤니? Arquillian을 이용한 Real Object 테스트
테스트 어디까지 해봤니? Arquillian을 이용한 Real Object 테스트jbugkorea
 
Java Course 6: Introduction to Agile
Java Course 6: Introduction to AgileJava Course 6: Introduction to Agile
Java Course 6: Introduction to AgileAnton Keks
 
1 Module 1 Introduction.pptx
1 Module 1 Introduction.pptx1 Module 1 Introduction.pptx
1 Module 1 Introduction.pptxBhargaviDalal3
 
Kubernetes your tests! automation with docker on google cloud platform
Kubernetes your tests! automation with docker on google cloud platformKubernetes your tests! automation with docker on google cloud platform
Kubernetes your tests! automation with docker on google cloud platformLivePerson
 
Agile Java Testing With Open Source Frameworks
Agile Java Testing With Open Source FrameworksAgile Java Testing With Open Source Frameworks
Agile Java Testing With Open Source FrameworksViraf Karai
 
"Java memory model for practitioners" at JavaLand 2017 by Vadym Kazulkin/Rodi...
"Java memory model for practitioners" at JavaLand 2017 by Vadym Kazulkin/Rodi..."Java memory model for practitioners" at JavaLand 2017 by Vadym Kazulkin/Rodi...
"Java memory model for practitioners" at JavaLand 2017 by Vadym Kazulkin/Rodi...Vadym Kazulkin
 
Better code, littler classes
Better code, littler classesBetter code, littler classes
Better code, littler classesdrewz lin
 
Extending Arquillian graphene
Extending Arquillian graphene Extending Arquillian graphene
Extending Arquillian graphene Rudy De Busscher
 
Building Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with ScalaBuilding Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with ScalaWO Community
 
Moving to Java EE 6 and CDI and away from the clutter
Moving to Java EE 6 and CDI and away from the clutterMoving to Java EE 6 and CDI and away from the clutter
Moving to Java EE 6 and CDI and away from the clutterDan Allen
 
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...Vadym Kazulkin
 
GeeCON 2012 hurdle run through ejb testing
GeeCON 2012 hurdle run through ejb testingGeeCON 2012 hurdle run through ejb testing
GeeCON 2012 hurdle run through ejb testingJakub Marchwicki
 

Similaire à Real Java EE Testing with Arquillian and ShrinkWrap (20)

Throwing complexity over the wall: Rapid development for enterprise Java (Jav...
Throwing complexity over the wall: Rapid development for enterprise Java (Jav...Throwing complexity over the wall: Rapid development for enterprise Java (Jav...
Throwing complexity over the wall: Rapid development for enterprise Java (Jav...
 
Jakarta EE Test Strategies (2022)
Jakarta EE Test Strategies (2022)Jakarta EE Test Strategies (2022)
Jakarta EE Test Strategies (2022)
 
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
 
Arquillian 소개
Arquillian 소개Arquillian 소개
Arquillian 소개
 
테스트 어디까지 해봤니? Arquillian을 이용한 Real Object 테스트
테스트 어디까지 해봤니? Arquillian을 이용한 Real Object 테스트테스트 어디까지 해봤니? Arquillian을 이용한 Real Object 테스트
테스트 어디까지 해봤니? Arquillian을 이용한 Real Object 테스트
 
Java Course 6: Introduction to Agile
Java Course 6: Introduction to AgileJava Course 6: Introduction to Agile
Java Course 6: Introduction to Agile
 
Unit testing hippo
Unit testing hippoUnit testing hippo
Unit testing hippo
 
1 Module 1 Introduction.pptx
1 Module 1 Introduction.pptx1 Module 1 Introduction.pptx
1 Module 1 Introduction.pptx
 
Js tacktalk team dev js testing performance
Js tacktalk team dev js testing performanceJs tacktalk team dev js testing performance
Js tacktalk team dev js testing performance
 
Kubernetes your tests! automation with docker on google cloud platform
Kubernetes your tests! automation with docker on google cloud platformKubernetes your tests! automation with docker on google cloud platform
Kubernetes your tests! automation with docker on google cloud platform
 
Agile Java Testing With Open Source Frameworks
Agile Java Testing With Open Source FrameworksAgile Java Testing With Open Source Frameworks
Agile Java Testing With Open Source Frameworks
 
"Java memory model for practitioners" at JavaLand 2017 by Vadym Kazulkin/Rodi...
"Java memory model for practitioners" at JavaLand 2017 by Vadym Kazulkin/Rodi..."Java memory model for practitioners" at JavaLand 2017 by Vadym Kazulkin/Rodi...
"Java memory model for practitioners" at JavaLand 2017 by Vadym Kazulkin/Rodi...
 
Building with Gradle
Building with GradleBuilding with Gradle
Building with Gradle
 
Better code, littler classes
Better code, littler classesBetter code, littler classes
Better code, littler classes
 
Extending Arquillian graphene
Extending Arquillian graphene Extending Arquillian graphene
Extending Arquillian graphene
 
Building Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with ScalaBuilding Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with Scala
 
Moving to Java EE 6 and CDI and away from the clutter
Moving to Java EE 6 and CDI and away from the clutterMoving to Java EE 6 and CDI and away from the clutter
Moving to Java EE 6 and CDI and away from the clutter
 
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
 
GeeCON 2012 hurdle run through ejb testing
GeeCON 2012 hurdle run through ejb testingGeeCON 2012 hurdle run through ejb testing
GeeCON 2012 hurdle run through ejb testing
 
Building with Gradle
Building with GradleBuilding with Gradle
Building with Gradle
 

Dernier

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 

Dernier (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 

Real Java EE Testing with Arquillian and ShrinkWrap

  • 1. Real Java EE Testing with Arquillian and ShrinkWrap Don't fake it! Dan Allen Senior Software Engineer JBoss, by Red Hat
  • 2. Who am I? ● Author of Seam in Action, Manning 2008 ● Seam Community Liaison ● Weld, Seam & Arquillian project member ● JSR-314 (JSF 2) EG representative ● Open Source advocate mojavelinux 2 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 3. Agenda #testrevolution ● Testing, what's the problem? ● Integration testing challenges ● A component model for tests ● ShrinkWrap ● Arquillian ● Case study 3 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 4. Why don't we test? 4 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 5. 5 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 6. Common integration testing challenges ● Active mocks to stand in for collaborators ● Configure application to use test data source(s) ● Deal with (lack of) classpath isolation ● Run a build to create/deploy application archive 6 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 7. Skip the Build! Test in-container! 7 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 8. container n. manages a runtime environment and provides resources, a component model and a set of services 8 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 9. A component model for tests 9 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 10. Unit tests vs integration tests Unit Integration ● Fine-grained ● Coarse-grained ● Simple ● Complex ● Test single API call ● Test intricate web of calls ● Fast, fast, fast ● Sloooooooow ● Easily run in an IDE ● Run in an IDE? How? 10 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 11. Testing bandgap and compounding effort Functional complexity Thought and effort Unit Tests Integration Tests Functional Tests 11 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 12. Testing continuum with Arquillian Functional complexity Thought and effort Unit Tests Integration Tests Functional Tests 12 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 13. In-container approach to integration testing ● Separate container process ● Test deployed as archive ● Test runs in-container ● Results collected remotely 13 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 14. Weighing in-container testing Pros Cons ● Rely on shared memory ● Lack of isolation ● Pass-by-reference ● Environment not “true” ● Don't need remote views ● Managed concurrency 14 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 15. Don't tie your tests to a build! ● Extra, external setup ● Adds time to tests ● Coarse-grained packaging 15 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 16. n. a simple, Apache-licensed Java API for assembling archives like JARs, WARs, EARs; developed by the JBoss Community 16 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 17. Benefits of ShrinkWrap ● IDE incremental compilation ● Save and re-run ● Skip the build! ● Simple API ● Tooling views ● Export and debugging ● Micro-deployments 17 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 18. Fluent archive creation final JavaArchive archive = ShrinkWrap.create("slsb.jar", JavaArchive.class) .addClasses(Greeter.class, GreeterBean.class); System.out.println(archive.toString(true)); Yields output: slsb.jar: /com/ /com/acme/ /com/acme/app/ /com/acme/app/ejb3/ /com/acme/app/ejb3/Greeter.class /com/acme/app/ejb3/GreeterBean.class 18 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 19. Architecture overview 19 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 20. n. a simple, Apache-licensed test harness that abstracts away container lifecycle and deployment from test logic so developers can easily develop a broad range of integration tests for their enterprise Java applications; developed by the JBoss Community 20 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 21. The mission of the Arquillian project is to... Make integration testing a breeze! 21 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 22. Prove it! @RunWith(Arquillian.class) public class GreeterTestCase { @Deployment public static JavaArchive createTestArchive() { return ShrinkWrap.create("test.jar", JavaArchive.class) .addClasses(Greeter.class, GreeterBean.class); } @EJB private Greeter greeter; @Test public void shouldBeAbleToInjectEJB() throws Exception { assertEquals("Hello, Earthlings", greeter.greet("Earthlings")); } } 22 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 23. Arquillian guts the plumbing ● Manages lifecycle of container ● start/stop ● bind/unbind ● Enriches test class (e.g, @Inject, @EJB, @Resource) ● Bundles test archive ● code under test ● libraries ● test class and invoker (in-container run mode only) ● Negotiates deployment of test archive ● Captures test results and failures 23 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 24. Benefits of Arquillian ● Write less (test) code ● As much or as little “integration” as you need ● Looks like a unit test, get fully functioning components ● Simple way to get an instance of component under test ● You don't hesitate when you need a resource ● Same test, multiple containers ● It's the real deal! 24 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 25. Test frameworks JUnit TestNG >= 4.6 >= 5.10 25 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 26. Test archives ● Built using ShrinkWrap API ● Bundle: ● code under test ● dependent Libraries ● test class and invoker (in-container run mode only) ● Deployed to container before test is executed ● Undeployed after test is executed 26 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 27. Build, what build? @Deployment public static JavaArchive createTestArchive() { return ShrinkWrap.create("test.jar", JavaArchive.class) .addClasses(Greeter.class, GreeterBean.class); } 27 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 28. Skip the build! @Deployment public static JavaArchive createTestArchive() { return ShrinkWrap.create("test.jar", JavaArchive.class) .addPackage(TranslateController.class.getPackage()) .addManifestResource( new ByteArrayAsset("<beans/>".getBytes()), ArchivePaths.create("beans.xml")); } 28 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 29. Micro deployments ● Deploy components in isolation ● Test one slice at a time ● Don't need to wait for full application build/startup ● Tune size of integration ● Layers by inclusion ● No “big bang” 29 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 30. Containers ● Mode ● Capability 30 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 31. Container modes ● Embedded ● Same JVM as test runner ● Tests executed by native test runner ● Lifecycle controlled by Arquillian ● Remote ● Separate JVM from test runner ● Tests executed over remote protocol ● Arquillian likely binds to ports 31 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 32. Container capabilities ● Java EE application server (JBoss AS, GlassFish, etc) ● Servlet container (Tomcat, Jetty) ● Managed bean container (Weld SE, Spring) ● OSGi ● SPI allows you to introduce any other container 32 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 33. Not just for Java EE public interface DeployableContainer { void setup(Context context, Configuration configuration); void start(Context context) throws LifecycleException; ContainerMethodExecutor deploy(Context context, Archive<?> archive) throws DeploymentException; void undeploy(Context context, Archive<?> archive) throws DeploymentException; void stop(Context context) throws LifecycleException; } 33 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 34. Test enrichment ● Injection ● Fields & method arguments ● @Inject, @Resource, @EJB, etc. ● Contexts ● Request & Conversation  Test method ● Session  Test class ● Application  Test class ● Interceptors & decorators 34 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 35. Test run modes ● In-container ● Test bundled in @Deployment archive ● Archive deployed to container ● Test runs inside container with code under test ● Test invokes code under test directly (same JVM) ● Local ● @Deployment archive unmodified ● Archive deployed to the container ● Test runs in original test runner ● Test interacts as a remote client (e.g., HTTP client) 35 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 36. In-container testing MDBs: A case study ● Asynchronous ● How will client know server is done processing? ● Thread.sleep() is prone to transient failures ● No return value ● How do we check post-conditions? ● In-container == same JVM ● Gives test control ● Allows test to inspect contexts 36 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 37. Arquillian is... ● an innovative approach to testing ● a component model for tests ● test infrastructure & plumbing ● a set of container implementations ● a little bit of magic ;) 37 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 38. JBoss Testing Initiative ● Comprehensive testing tool “stack” ● Establish a testing culture in Java EE ● #jbosstesting on irc.freenode.net ● Filling voids ● ShrinkWrap – Programmatic archive creation ● Arquillian – Managed integration testing ● Placeebo – Mock Java EE API implementations ● JSFUnit – Gray-box JSF testing ● Contribute to the unit testing frameworks? 38 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 39. Get Involved! ● Active and open community ● How to contribute: ● Ideas on forums or IRC ● Feedback on releases – still in alpha! ● Enhancements and bug fixes – we love patches! ● Documentation ● Blogs – share your stories! ● Come meet us: ● http://jboss.org/arquillian ● #jbosstesting on irc.freenode.net 39 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 40. http://jboss.org/arquillian 40 Real Java EE Testing: Arquillian and ShrinkWrap | Dan Allen
  • 41. Q&A http://jboss.org/arquillian http://jboss.org/shrinkwrap Dan Allen Senior Software Engineer JBoss, by Red Hat