Real Java EE Testing With And: Arquillian
Real Java EE Testing With And: Arquillian
Pete Muir
Principal Software Engineer
Red Hat, Inc.
Agenda #testrevolution
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?
Functional complexity
Infrastructural complexity
Functional complexity
Infrastructural complexity
Pros Cons
Rely on shared memory Still sloooow
Pass-by-reference Container set up
Don't need remote views
Each test is fully isolated
Environment is “truer”
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
JUnit TestNG
>= 4.6 >= 5.10
Mode
Capability
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
Injection
Fields & method arguments
@Inject, @Resource, @EJB, etc.
Contexts
Request & Conversation -> Test method
Session -> Test class
Application -> Test class
Interceptors & decorators
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)
http://jboss.org/arquillian
http://jboss.org/shrinkwrap