Testing the Java EE

Post on 21-Jan-2017

62 views 0 download

Transcript of Testing the Java EE

Testing the Java EEwith Arquillian

jug.bg | #bgjug | @bgjugSofia | October 23, 2015

Inspired by Reza Rahman

jug.bg | #bgjug | @bgjugSofia | October 23, 2015

AgendaArquillianTesting ServletTesting JSFTesting EJB3/CDITesting RS, WSSummary

jug.bg | #bgjug | @bgjugSofia | October 23, 2015

ArquillianJava EE testing is underestimated

Arquillian takes advantage of the most JEE features

Currently the best solution (but not the only)

Excels integration/regression testing

Can also help in performance, system etc. testing

Supports JUnit and TestNG

jug.bg | #bgjug | @bgjugSofia | October 23, 2015

Testing Servlet

Traditional problems for bootstraping the container– Arquillian coordinates the lifecycle– Helps the isolation

HtmlUnit or HttpUnit comes very handy

jug.bg | #bgjug | @bgjugSofia | October 23, 2015

Testing JSF2Same concept as Servlet testing

JSF2 project stages useful for testing– Development, production, system test, unit test

Drone/Selenium, Graphene for client side

Warp for complete JSF testing– Both client and server side tests

jug.bg | #bgjug | @bgjugSofia | October 23, 2015

Testing EJB3/CDIEJB3 is unexpectedly testable

CDI increases Java EE component model level testability by leaps and bounds

Embedded containers, generic DI, @Alternative, XML Deployment, interceptors

Test enrichment via injection and scoping

Both Mock unit testing and integration testing possible

Close to real environment

jug.bg | #bgjug | @bgjugSofia | October 23, 2015

Testing JPACDI/EJB3 and arquillian works great with JPA as well

– Still isolated JPA is possible

JPA 2.1 data loading and schema generation

@DataSourceDefinition within the application

XML overrides:– persistence.xml

Embedded DB are recommended to be used

DBUnit coexist smoothly

Transactions can be used

jug.bg | #bgjug | @bgjugSofia | October 23, 2015

Testing JAX-RS, WSSame general concept

JAX-RS, WebSocket and JAX-WS client APIs can be used arquillian

Can be automated with JMeter and SoapUI for example

jug.bg | #bgjug | @bgjugSofia | October 23, 2015

SummaryRobust and modern end-to-end solution for Java EE

EJB3, JPA2, CDI, JSF2, embedded containers, client APIs key enablers

Rich set of features

Vibrant community

jug.bg | #bgjug | @bgjugSofia | October 23, 2015

Learn moreArquillian– http://jboss.org/arquillian

jug.bg | #bgjug | @bgjugSofia | October 23, 2015

jug.bg | #bgjug | @bgjugSofia | October 23, 2015