Testing Java EE Applications Using Arquillian

Reza Rahman
Reza RahmanPrincipal Program Manager at Microsoft
Others Talk,
We Listen.
Testing Java EE
Applications
using Arquillian
Reza Rahman
Senior Architect
rrahman@captechconsulting.com
@reza_rahman
CapTech
Full-service US national IT consulting firm that focuses on client best interests,
trust, servant leadership, culture, professionalism and technical excellence.
#28 in Vault's Consulting Top 50
#3 Best Consulting Internship
#9 Best Overall Internship
#1 in Meeting Client’s Needs
#7 Best Firm to Work For
#1 in Career Development
Ranked for the
7th
Consecutive Year
Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
Testing, J2EE and Java EE
• Testing not addressed well by J2EE
• This has changed enormously with Java EE and Arquillian
• Java EE provides 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
Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
Testing Servlet
• Traditional problem is bootstrapping containers from tests
• Arquillian helps by coordinating container life-cycle
• Tests close to production environments
• Also helps isolate tests
• JAX-RS 2 client API comes in very handy
• Java SE 9 may have a better HTTP client API
• HtmlUnit, HttpUnit non-standard alternatives
Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
Servlet Testing Demo
https://github.com/m-reza-rahman/testing-javaee
Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
Testing JSF
• Same general concept as Servlet testing
• Warp ideal for complete JSF testing
• Client and server-side tests from Arquillian
• Drone/Selenium, Graphene often sufficient
• Just the client side
Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
JSF Testing Demo
https://github.com/m-reza-rahman/testing-javaee
Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
Testing CDI/EJB 3
• EJB 3 significantly more testable as it is merely POJOs
• CDI increases Java EE component model level testability by leaps and
bounds
• Embedded containers, generic POJO dependency injection, @Alternative,
XML deployment descriptors, interceptors major enablers
• Arquillian test enrichment through injection, scoping
• Both mock object based unit testing as well as integration testing is possible
• Likely sufficient to stick with integration testing using close to real runtime
environments
Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
Testing JPA
• CDI, EJB 3 and Arquillian works towards JPA testing
• Just testing JPA code is possible too but likely unnecessary
• JPA 2.1 data loading, schema generation
• Defining data sources within the application
• persistence.xml, orm.xml XML overrides
• Embedded databases like Java DB, Derby, HSQL
• DBUnit integration for better data consistency
• Tests can use transactions in Arquillian
Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
CDI, EJB 3, JPA Testing Demo
https://github.com/m-reza-rahman/testing-javaee
Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
Testing JAX-RS, WebSocket (and JAX-WS)
• Same general concept as Servlet testing
• You can use JAX-RS, WebSocket and JAX-WS client APIs with Arquillian
• For more complex cases consider UI based testing tools (e.g. soapUI for
REST and SOAP)
• JUnit integration possible
Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
JAX-RS Testing Demo
https://github.com/m-reza-rahman/testing-javaee
Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
WebSocket Testing Demo
https://github.com/m-reza-rahman/testing-javaee
Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
Arquillian Supported Containers
Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
Container Support
GlassFish Embedded, Managed, Remote
WildFly, JBoss Embedded, Managed, Remote
Weld SE, Weld EE Embedded
TomEE, OpenEJB, OpenWebBeans Embedded, Managed, Remote
WebSphere, Liberty Embedded, Managed, Remote
WebLogic Managed, Remote
Summary
• Robust, end-to-end testing a true reality with modern Java EE
• A number of key enablers in Java EE
• Arquillian best-of-breed Java EE testing tool
• Rich set of features, vibrant community
Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
Resources
• Java EE Tutorials
• http://docs.oracle.com/javaee/7/tutorial/doc/home.htm
• Arquillian
• http://jboss.org/arquillian
Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
1 of 17

Recommended

Java on Azure by
Java on AzureJava on Azure
Java on AzurePhilly JUG
2.1K views27 slides
What's New in WebLogic 12.1.3 and Beyond by
What's New in WebLogic 12.1.3 and BeyondWhat's New in WebLogic 12.1.3 and Beyond
What's New in WebLogic 12.1.3 and BeyondOracle
20.3K views16 slides
Java API for JSON Binding - Introduction and update by
Java API for JSON Binding - Introduction and updateJava API for JSON Binding - Introduction and update
Java API for JSON Binding - Introduction and updateMartin Grebac
3.1K views83 slides
JavaScript Frameworks and Java EE – A Great Match by
JavaScript Frameworks and Java EE – A Great MatchJavaScript Frameworks and Java EE – A Great Match
JavaScript Frameworks and Java EE – A Great MatchReza Rahman
132.8K views11 slides
Seven Points for Applying Java EE 7 by
Seven Points for Applying Java EE 7Seven Points for Applying Java EE 7
Seven Points for Applying Java EE 7Hirofumi Iwasaki
24.2K views67 slides
Java EE 8: On the Horizon by
Java EE 8:  On the HorizonJava EE 8:  On the Horizon
Java EE 8: On the HorizonJosh Juneau
13.3K views72 slides

More Related Content

What's hot

Down-to-Earth Microservices with Java EE by
Down-to-Earth Microservices with Java EEDown-to-Earth Microservices with Java EE
Down-to-Earth Microservices with Java EEReza Rahman
103.6K views17 slides
Java EE Revisits GoF Design Patterns by
Java EE Revisits GoF Design PatternsJava EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsMurat Yener
15.9K views46 slides
Modern web application development with java ee 7 by
Modern web application development with java ee 7Modern web application development with java ee 7
Modern web application development with java ee 7Shekhar Gulati
24K views52 slides
Java EE 6 Adoption in One of the World’s Largest Online Financial Systems by
Java EE 6 Adoption in One of the World’s Largest Online Financial SystemsJava EE 6 Adoption in One of the World’s Largest Online Financial Systems
Java EE 6 Adoption in One of the World’s Largest Online Financial SystemsArshal Ameen
10.5K views44 slides
Finally, EE Security API JSR 375 by
Finally, EE Security API JSR 375Finally, EE Security API JSR 375
Finally, EE Security API JSR 375Alex Kosowski
13.4K views80 slides
HTTP/2 comes to Java. What Servlet 4.0 means to you. DevNexus 2015 by
HTTP/2 comes to Java.  What Servlet 4.0 means to you. DevNexus 2015HTTP/2 comes to Java.  What Servlet 4.0 means to you. DevNexus 2015
HTTP/2 comes to Java. What Servlet 4.0 means to you. DevNexus 2015Edward Burns
19.2K views82 slides

What's hot(16)

Down-to-Earth Microservices with Java EE by Reza Rahman
Down-to-Earth Microservices with Java EEDown-to-Earth Microservices with Java EE
Down-to-Earth Microservices with Java EE
Reza Rahman103.6K views
Java EE Revisits GoF Design Patterns by Murat Yener
Java EE Revisits GoF Design PatternsJava EE Revisits GoF Design Patterns
Java EE Revisits GoF Design Patterns
Murat Yener15.9K views
Modern web application development with java ee 7 by Shekhar Gulati
Modern web application development with java ee 7Modern web application development with java ee 7
Modern web application development with java ee 7
Shekhar Gulati24K views
Java EE 6 Adoption in One of the World’s Largest Online Financial Systems by Arshal Ameen
Java EE 6 Adoption in One of the World’s Largest Online Financial SystemsJava EE 6 Adoption in One of the World’s Largest Online Financial Systems
Java EE 6 Adoption in One of the World’s Largest Online Financial Systems
Arshal Ameen10.5K views
Finally, EE Security API JSR 375 by Alex Kosowski
Finally, EE Security API JSR 375Finally, EE Security API JSR 375
Finally, EE Security API JSR 375
Alex Kosowski13.4K views
HTTP/2 comes to Java. What Servlet 4.0 means to you. DevNexus 2015 by Edward Burns
HTTP/2 comes to Java.  What Servlet 4.0 means to you. DevNexus 2015HTTP/2 comes to Java.  What Servlet 4.0 means to you. DevNexus 2015
HTTP/2 comes to Java. What Servlet 4.0 means to you. DevNexus 2015
Edward Burns19.2K views
EJB and CDI - Alignment and Strategy by David Delabassee
EJB and CDI - Alignment and StrategyEJB and CDI - Alignment and Strategy
EJB and CDI - Alignment and Strategy
David Delabassee31.9K views
Java EE 8 - An instant snapshot by David Delabassee
Java EE 8 - An instant snapshot Java EE 8 - An instant snapshot
Java EE 8 - An instant snapshot
David Delabassee10.7K views
JavaOne 2011: Migrating Spring Applications to Java EE 6 by Bert Ertman
JavaOne 2011: Migrating Spring Applications to Java EE 6JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6
Bert Ertman119.7K views
Top 50 java ee 7 best practices [con5669] by Ryan Cuprak
Top 50 java ee 7 best practices [con5669]Top 50 java ee 7 best practices [con5669]
Top 50 java ee 7 best practices [con5669]
Ryan Cuprak9.3K views
2015 JavaOne EJB/CDI Alignment by David Blevins
2015 JavaOne EJB/CDI Alignment2015 JavaOne EJB/CDI Alignment
2015 JavaOne EJB/CDI Alignment
David Blevins30.7K views
Reactive Java EE - Let Me Count the Ways! by Reza Rahman
Reactive Java EE - Let Me Count the Ways!Reactive Java EE - Let Me Count the Ways!
Reactive Java EE - Let Me Count the Ways!
Reza Rahman104.5K views
What is tackled in the Java EE Security API (Java EE 8) by Rudy De Busscher
What is tackled in the Java EE Security API (Java EE 8)What is tackled in the Java EE Security API (Java EE 8)
What is tackled in the Java EE Security API (Java EE 8)
Rudy De Busscher18.8K views
Java EE 8 Update by Ryan Cuprak
Java EE 8 UpdateJava EE 8 Update
Java EE 8 Update
Ryan Cuprak9.6K views

Similar to Testing Java EE Applications Using Arquillian

How to Thrive on REST/WebSocket-Based Microservices by
How to Thrive on REST/WebSocket-Based MicroservicesHow to Thrive on REST/WebSocket-Based Microservices
How to Thrive on REST/WebSocket-Based MicroservicesPavel Bucek
1.2K views42 slides
Oracle WebLogic Server 12.2.1 Do More with Less by
Oracle WebLogic Server 12.2.1 Do More with LessOracle WebLogic Server 12.2.1 Do More with Less
Oracle WebLogic Server 12.2.1 Do More with LessEd Burns
1.5K views72 slides
Whats New in Java 5, 6, & 7 (Webinar Presentation - June 2013) by
Whats New in Java 5, 6, & 7 (Webinar Presentation - June 2013)Whats New in Java 5, 6, & 7 (Webinar Presentation - June 2013)
Whats New in Java 5, 6, & 7 (Webinar Presentation - June 2013)DevelopIntelligence
1.9K views47 slides
OOW15 - Testing Oracle E-Business Suite Best Practices by
OOW15 - Testing Oracle E-Business Suite Best PracticesOOW15 - Testing Oracle E-Business Suite Best Practices
OOW15 - Testing Oracle E-Business Suite Best Practicesvasuballa
3.6K views45 slides
Testlink Test Management with Teamforge by
Testlink Test Management with TeamforgeTestlink Test Management with Teamforge
Testlink Test Management with TeamforgeCollabNet
2.1K views18 slides
Module-1_Getting-Started_with_selenium_and_Java_basics.pdf by
Module-1_Getting-Started_with_selenium_and_Java_basics.pdfModule-1_Getting-Started_with_selenium_and_Java_basics.pdf
Module-1_Getting-Started_with_selenium_and_Java_basics.pdfdevika266518
17 views73 slides

Similar to Testing Java EE Applications Using Arquillian(20)

How to Thrive on REST/WebSocket-Based Microservices by Pavel Bucek
How to Thrive on REST/WebSocket-Based MicroservicesHow to Thrive on REST/WebSocket-Based Microservices
How to Thrive on REST/WebSocket-Based Microservices
Pavel Bucek1.2K views
Oracle WebLogic Server 12.2.1 Do More with Less by Ed Burns
Oracle WebLogic Server 12.2.1 Do More with LessOracle WebLogic Server 12.2.1 Do More with Less
Oracle WebLogic Server 12.2.1 Do More with Less
Ed Burns1.5K views
Whats New in Java 5, 6, & 7 (Webinar Presentation - June 2013) by DevelopIntelligence
Whats New in Java 5, 6, & 7 (Webinar Presentation - June 2013)Whats New in Java 5, 6, & 7 (Webinar Presentation - June 2013)
Whats New in Java 5, 6, & 7 (Webinar Presentation - June 2013)
DevelopIntelligence1.9K views
OOW15 - Testing Oracle E-Business Suite Best Practices by vasuballa
OOW15 - Testing Oracle E-Business Suite Best PracticesOOW15 - Testing Oracle E-Business Suite Best Practices
OOW15 - Testing Oracle E-Business Suite Best Practices
vasuballa3.6K views
Testlink Test Management with Teamforge by CollabNet
Testlink Test Management with TeamforgeTestlink Test Management with Teamforge
Testlink Test Management with Teamforge
CollabNet2.1K views
Module-1_Getting-Started_with_selenium_and_Java_basics.pdf by devika266518
Module-1_Getting-Started_with_selenium_and_Java_basics.pdfModule-1_Getting-Started_with_selenium_and_Java_basics.pdf
Module-1_Getting-Started_with_selenium_and_Java_basics.pdf
devika26651817 views
Java EE7 in action by Ankara JUG
Java EE7 in actionJava EE7 in action
Java EE7 in action
Ankara JUG947 views
SVCC 2011 - 0 - 60: QA Automation @ Box by Peter White
SVCC 2011 - 0 - 60: QA Automation @ BoxSVCC 2011 - 0 - 60: QA Automation @ Box
SVCC 2011 - 0 - 60: QA Automation @ Box
Peter White487 views
ocejwcd 6 preparation guide by Ganesh P
ocejwcd 6 preparation guideocejwcd 6 preparation guide
ocejwcd 6 preparation guide
Ganesh P1.1K views
Taking Flexibility to the Next Level by ForgeRock
Taking Flexibility to the Next LevelTaking Flexibility to the Next Level
Taking Flexibility to the Next Level
ForgeRock2.8K views
Interactive Java Support to your tool -- The JShell API and Architecture by JavaDayUA
Interactive Java Support to your tool -- The JShell API and ArchitectureInteractive Java Support to your tool -- The JShell API and Architecture
Interactive Java Support to your tool -- The JShell API and Architecture
JavaDayUA1.1K views
Agile Java Testing With Open Source Frameworks by Viraf Karai
Agile Java Testing With Open Source FrameworksAgile Java Testing With Open Source Frameworks
Agile Java Testing With Open Source Frameworks
Viraf Karai3.5K views
Automated Acceptance Tests & Tool choice by toddbr
Automated Acceptance Tests & Tool choiceAutomated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choice
toddbr8K views
Mastering DevOps with Oracle by jeckels
Mastering DevOps with Oracle Mastering DevOps with Oracle
Mastering DevOps with Oracle
jeckels17.7K views
Melhore o Desenvolvimento do Time com DevOps na Nuvem by Bruno Borges
Melhore o Desenvolvimento do Time com DevOps na NuvemMelhore o Desenvolvimento do Time com DevOps na Nuvem
Melhore o Desenvolvimento do Time com DevOps na Nuvem
Bruno Borges3.9K views
ocejwsd 6 preparation guide by Ganesh P
ocejwsd 6 preparation guideocejwsd 6 preparation guide
ocejwsd 6 preparation guide
Ganesh P967 views
MySQL Tech Tour 2015 - 5.7 Connector/J/Net by Mark Swarbrick
MySQL Tech Tour 2015 - 5.7 Connector/J/NetMySQL Tech Tour 2015 - 5.7 Connector/J/Net
MySQL Tech Tour 2015 - 5.7 Connector/J/Net
Mark Swarbrick729 views

Recently uploaded

Black and White Modern Science Presentation.pptx by
Black and White Modern Science Presentation.pptxBlack and White Modern Science Presentation.pptx
Black and White Modern Science Presentation.pptxmaryamkhalid2916
14 views21 slides
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV by
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTVSplunk
86 views20 slides
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu... by
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...NUS-ISS
32 views54 slides
Spesifikasi Lengkap ASUS Vivobook Go 14 by
Spesifikasi Lengkap ASUS Vivobook Go 14Spesifikasi Lengkap ASUS Vivobook Go 14
Spesifikasi Lengkap ASUS Vivobook Go 14Dot Semarang
35 views1 slide
Web Dev - 1 PPT.pdf by
Web Dev - 1 PPT.pdfWeb Dev - 1 PPT.pdf
Web Dev - 1 PPT.pdfgdsczhcet
52 views45 slides
Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum... by
Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum...Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum...
Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum...NUS-ISS
28 views35 slides

Recently uploaded(20)

Black and White Modern Science Presentation.pptx by maryamkhalid2916
Black and White Modern Science Presentation.pptxBlack and White Modern Science Presentation.pptx
Black and White Modern Science Presentation.pptx
maryamkhalid291614 views
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV by Splunk
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV
Splunk86 views
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu... by NUS-ISS
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...
NUS-ISS32 views
Spesifikasi Lengkap ASUS Vivobook Go 14 by Dot Semarang
Spesifikasi Lengkap ASUS Vivobook Go 14Spesifikasi Lengkap ASUS Vivobook Go 14
Spesifikasi Lengkap ASUS Vivobook Go 14
Dot Semarang35 views
Web Dev - 1 PPT.pdf by gdsczhcet
Web Dev - 1 PPT.pdfWeb Dev - 1 PPT.pdf
Web Dev - 1 PPT.pdf
gdsczhcet52 views
Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum... by NUS-ISS
Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum...Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum...
Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum...
NUS-ISS28 views
The details of description: Techniques, tips, and tangents on alternative tex... by BookNet Canada
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...
BookNet Canada110 views
Understanding GenAI/LLM and What is Google Offering - Felix Goh by NUS-ISS
Understanding GenAI/LLM and What is Google Offering - Felix GohUnderstanding GenAI/LLM and What is Google Offering - Felix Goh
Understanding GenAI/LLM and What is Google Offering - Felix Goh
NUS-ISS39 views
Future of Learning - Khoong Chan Meng by NUS-ISS
Future of Learning - Khoong Chan MengFuture of Learning - Khoong Chan Meng
Future of Learning - Khoong Chan Meng
NUS-ISS31 views
Attacking IoT Devices from a Web Perspective - Linux Day by Simone Onofri
Attacking IoT Devices from a Web Perspective - Linux Day Attacking IoT Devices from a Web Perspective - Linux Day
Attacking IoT Devices from a Web Perspective - Linux Day
Simone Onofri15 views
handbook for web 3 adoption.pdf by Liveplex
handbook for web 3 adoption.pdfhandbook for web 3 adoption.pdf
handbook for web 3 adoption.pdf
Liveplex19 views
SAP Automation Using Bar Code and FIORI.pdf by Virendra Rai, PMP
SAP Automation Using Bar Code and FIORI.pdfSAP Automation Using Bar Code and FIORI.pdf
SAP Automation Using Bar Code and FIORI.pdf
PharoJS - Zürich Smalltalk Group Meetup November 2023 by Noury Bouraqadi
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023
Noury Bouraqadi113 views
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors by sugiuralab
TouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective SensorsTouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective Sensors
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors
sugiuralab11 views

Testing Java EE Applications Using Arquillian

  • 1. Others Talk, We Listen. Testing Java EE Applications using Arquillian Reza Rahman Senior Architect rrahman@captechconsulting.com @reza_rahman
  • 2. CapTech Full-service US national IT consulting firm that focuses on client best interests, trust, servant leadership, culture, professionalism and technical excellence. #28 in Vault's Consulting Top 50 #3 Best Consulting Internship #9 Best Overall Internship #1 in Meeting Client’s Needs #7 Best Firm to Work For #1 in Career Development Ranked for the 7th Consecutive Year Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  • 3. Testing, J2EE and Java EE • Testing not addressed well by J2EE • This has changed enormously with Java EE and Arquillian • Java EE provides 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 Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  • 4. Testing Servlet • Traditional problem is bootstrapping containers from tests • Arquillian helps by coordinating container life-cycle • Tests close to production environments • Also helps isolate tests • JAX-RS 2 client API comes in very handy • Java SE 9 may have a better HTTP client API • HtmlUnit, HttpUnit non-standard alternatives Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  • 5. Servlet Testing Demo https://github.com/m-reza-rahman/testing-javaee Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  • 6. Testing JSF • Same general concept as Servlet testing • Warp ideal for complete JSF testing • Client and server-side tests from Arquillian • Drone/Selenium, Graphene often sufficient • Just the client side Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  • 7. JSF Testing Demo https://github.com/m-reza-rahman/testing-javaee Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  • 8. Testing CDI/EJB 3 • EJB 3 significantly more testable as it is merely POJOs • CDI increases Java EE component model level testability by leaps and bounds • Embedded containers, generic POJO dependency injection, @Alternative, XML deployment descriptors, interceptors major enablers • Arquillian test enrichment through injection, scoping • Both mock object based unit testing as well as integration testing is possible • Likely sufficient to stick with integration testing using close to real runtime environments Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  • 9. Testing JPA • CDI, EJB 3 and Arquillian works towards JPA testing • Just testing JPA code is possible too but likely unnecessary • JPA 2.1 data loading, schema generation • Defining data sources within the application • persistence.xml, orm.xml XML overrides • Embedded databases like Java DB, Derby, HSQL • DBUnit integration for better data consistency • Tests can use transactions in Arquillian Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  • 10. CDI, EJB 3, JPA Testing Demo https://github.com/m-reza-rahman/testing-javaee Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  • 11. Testing JAX-RS, WebSocket (and JAX-WS) • Same general concept as Servlet testing • You can use JAX-RS, WebSocket and JAX-WS client APIs with Arquillian • For more complex cases consider UI based testing tools (e.g. soapUI for REST and SOAP) • JUnit integration possible Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  • 12. JAX-RS Testing Demo https://github.com/m-reza-rahman/testing-javaee Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  • 13. WebSocket Testing Demo https://github.com/m-reza-rahman/testing-javaee Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  • 14. Arquillian Supported Containers Copyright © 2015 CapTech Ventures, Inc. All rights reserved. Container Support GlassFish Embedded, Managed, Remote WildFly, JBoss Embedded, Managed, Remote Weld SE, Weld EE Embedded TomEE, OpenEJB, OpenWebBeans Embedded, Managed, Remote WebSphere, Liberty Embedded, Managed, Remote WebLogic Managed, Remote
  • 15. Summary • Robust, end-to-end testing a true reality with modern Java EE • A number of key enablers in Java EE • Arquillian best-of-breed Java EE testing tool • Rich set of features, vibrant community Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  • 16. Resources • Java EE Tutorials • http://docs.oracle.com/javaee/7/tutorial/doc/home.htm • Arquillian • http://jboss.org/arquillian Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  • 17. Copyright © 2015 CapTech Ventures, Inc. All rights reserved.