Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Public 1 Testing Java EE Applications using Arquillian Reza Rahman Java EE/GlassFish.

Similar presentations


Presentation on theme: "Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Public 1 Testing Java EE Applications using Arquillian Reza Rahman Java EE/GlassFish."— Presentation transcript:

1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Public 1 Testing Java EE Applications using Arquillian Reza Rahman Java EE/GlassFish Evangelist Reza.Rahman@Oracle.com @reza_rahman

2 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Public 2 Testing, J2EE and Java EE  Testing not addressed well by J2EE  Java EE helps enormously by providing a number of enabling features  Arquillian takes full advantage of these features  Not the only solution, but best-of-breed  Developer (unit and integration) testing focus for this talk – Arquillian can also help with performance, system, etc testing – Arquillian excels at integration/regression testing  I’ll primarily focus on JUnit, not TestNG – TestNG also supported by Arquillian

3 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Public 3 Java EE 7 JCA JACC EJB 3 Servlet JSF 2 JAX-RS JMS 2 JTA EL JASPIC CDI JPA UpdatedMajor Release New Concurrency Utilities Concurrency Utilities Batch Applications Java API for JSON Java API for JSON Java API for WebSocket Java API for WebSocket JavaMail JAX-WS JAXB Bean Validation

4 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Public 4 Java EE Testing Enablers

5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Public 5 Testing Servlet  JAX-RS 2 client API comes in very handy!  HttpUnit, HtmlUnit good tools as well  Traditional problem is bootstrapping containers from tests

6 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Public 6 Servlet Testing Demo https://github.com/m-reza-rahman/testing-javaee

7 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Public 7 Testing JSF 2  JSF 2 project stages invaluable for debugging and testing  Warp ideal for complete JSF testing – Client and server-side tests  Drone/Selenium, Graphene often sufficient

8 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Public 8 JSF 2 Testing Demo https://github.com/m-reza-rahman/testing-javaee

9 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Public 9 Testing CDI/EJB 3  CDI increases Java EE component model level testability by leaps and bounds  Embedded containers, generic dependency injection, @Alternative, portable extensions, XML deployment descriptors, interceptors enablers  Both mock object based unit testing as well as integration testing is possible  Likely best to stick with integration testing using close to the real runtime environment

10 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Public 10 Testing JPA  Embedded container, CDI and Arquillian integration works well for JPA  Consider using embedded databases like Java DB, Derby, HSQL  Defining data sources with the application - @DataSourceDefinition  You can use JPA 2.1 data loading, schema generation and DBUnit for better data consistency  Tests can use transactions  Take advantage of XML overrides

11 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Public 11 CDI, EJB 3, JPA Testing Demo https://github.com/m-reza-rahman/testing-javaee

12 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Public 12 Testing JAX-RS, WebSocket (and JAX-WS)  You can use JAX-RS, WebSocket and JAX-WS client APIs with JUnit/Arquillian  For more complex cases consider UI based testing tools (e.g. soapUI for REST and SOAP)

13 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Public 13 JAX-RS, WebSocket Testing Demo https://github.com/m-reza-rahman/testing-javaee

14 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Public 14 Arquillian Supported Containers Container Support GlassFishEmbedded, Managed, Remote WildFly, JBossEmbedded, Managed, Remote Weld SE, Weld EEEmbedded TomEE, OpenEJB, OpenWebBeansEmbedded, Managed, Remote WebLogicManaged, Remote WebSphere, LibertyManaged, Remote

15 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Public 15 Summary  Robust, end-to-end testing a true reality with modern Java EE  EJB 3, JPA 2, CDI, JSF 2, embedded containers, portable extensions, XML deployment descriptors, client APIs key enablers  Range of new and existing tools available to fit your testing methodology, requirements  Arquillian best-of-breed Java EE testing tool  Rich set of features, vibrant community  Get involved!

16 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Public 16 Learning More  Java EE Tutorials – http://docs.oracle.com/javaee/7/tutorial/doc/home.htm http://docs.oracle.com/javaee/7/tutorial/doc/home.htm  Arquillian – http://jboss.org/arquillian http://jboss.org/arquillian  The Aquarium – http://blogs.oracle.com/theaquarium http://blogs.oracle.com/theaquarium

17 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Public 17


Download ppt "Copyright © 2012, Oracle and/or its affiliates. All rights reserved.Public 1 Testing Java EE Applications using Arquillian Reza Rahman Java EE/GlassFish."

Similar presentations


Ads by Google