frictionless integration - jboss · unit tests integration tests functional tests functional...
TRANSCRIPT
![Page 1: Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional complexity Configuration complexity T h o u g h t a n d E f f o r t. ... • as easy as](https://reader033.vdocument.in/reader033/viewer/2022052001/601416c99d5e9b63c874f452/html5/thumbnails/1.jpg)
![Page 2: Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional complexity Configuration complexity T h o u g h t a n d E f f o r t. ... • as easy as](https://reader033.vdocument.in/reader033/viewer/2022052001/601416c99d5e9b63c874f452/html5/thumbnails/2.jpg)
Frictionless integration testing in the Cloud
Adrian Cole Aslak Knutsen
Arquillianjclouds
![Page 3: Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional complexity Configuration complexity T h o u g h t a n d E f f o r t. ... • as easy as](https://reader033.vdocument.in/reader033/viewer/2022052001/601416c99d5e9b63c874f452/html5/thumbnails/3.jpg)
Agenda
• Introduction
• Arquillian• jclouds
• Demo• Open Discussion
![Page 4: Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional complexity Configuration complexity T h o u g h t a n d E f f o r t. ... • as easy as](https://reader033.vdocument.in/reader033/viewer/2022052001/601416c99d5e9b63c874f452/html5/thumbnails/4.jpg)
Why don't we test?
![Page 5: Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional complexity Configuration complexity T h o u g h t a n d E f f o r t. ... • as easy as](https://reader033.vdocument.in/reader033/viewer/2022052001/601416c99d5e9b63c874f452/html5/thumbnails/5.jpg)
The “testing bandgap” and compounding effort
Unit Tests Integration Tests Functional Tests
Functional complexity
Configuration complexity
Tho
ught
and
Eff
ort
![Page 6: Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional complexity Configuration complexity T h o u g h t a n d E f f o r t. ... • as easy as](https://reader033.vdocument.in/reader033/viewer/2022052001/601416c99d5e9b63c874f452/html5/thumbnails/6.jpg)
Common integration testing challenges
• Start a container environment• Run a build to create/deploy application
archive
• Mock dependent components
• Configure application to use test data source(s)
• Deal with (lack of) classpath isolation
![Page 7: Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional complexity Configuration complexity T h o u g h t a n d E f f o r t. ... • as easy as](https://reader033.vdocument.in/reader033/viewer/2022052001/601416c99d5e9b63c874f452/html5/thumbnails/7.jpg)
Arquillian's testing continuum
Unit Tests Integration Tests Functional Tests
Functional complexity
Configuration complexity
Tho
ught
and
Eff
ort
Reducing enterprise testing to child's play
![Page 8: Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional complexity Configuration complexity T h o u g h t a n d E f f o r t. ... • as easy as](https://reader033.vdocument.in/reader033/viewer/2022052001/601416c99d5e9b63c874f452/html5/thumbnails/8.jpg)
What if integration testing could be...
• as easy as writing a unit test• run in the IDE, leveraging incremental
builds
• limited to select components running in isolation– ...avoiding the “big bang” integration
roadblock
![Page 9: Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional complexity Configuration complexity T h o u g h t a n d E f f o r t. ... • as easy as](https://reader033.vdocument.in/reader033/viewer/2022052001/601416c99d5e9b63c874f452/html5/thumbnails/9.jpg)
Step 1: Liberate tests from the build!
• Adds overhead to development cycle • Slows down test execution
• Uses coarse-grained classpath/package
• Keep it manageable!
– Well-defined “unit”– Classpath control
![Page 10: Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional complexity Configuration complexity T h o u g h t a n d E f f o r t. ... • as easy as](https://reader033.vdocument.in/reader033/viewer/2022052001/601416c99d5e9b63c874f452/html5/thumbnails/10.jpg)
Step 2: Gut the plumbing!
• Manage lifecycle of container• Enrich test class
• Package test archive• Deploy test archive
• Invoke tests• Capture test results
• What's left?– Pure test logic
![Page 11: Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional complexity Configuration complexity T h o u g h t a n d E f f o r t. ... • as easy as](https://reader033.vdocument.in/reader033/viewer/2022052001/601416c99d5e9b63c874f452/html5/thumbnails/11.jpg)
Prove it.@RunWith(Arquillian.class)public class GreeterTestCase {
@Deployment public static Archive<?> createDeployment() { return ShrinkWrap.create(JavaArchive.class) .addClasses(Greeter.class, GreeterBean.class); } @EJB private Greeter greeter; @Test public void shouldBeAbleToInvokeEJB() throws Exception { assertEquals("Hello, Earthlings", greeter.greet("Earthlings")); }}
![Page 12: Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional complexity Configuration complexity T h o u g h t a n d E f f o r t. ... • as easy as](https://reader033.vdocument.in/reader033/viewer/2022052001/601416c99d5e9b63c874f452/html5/thumbnails/12.jpg)
jclouds
• Adrian Cole (@jclouds)
• Founded jclouds last march
• Contributor on many cloud programs
![Page 13: Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional complexity Configuration complexity T h o u g h t a n d E f f o r t. ... • as easy as](https://reader033.vdocument.in/reader033/viewer/2022052001/601416c99d5e9b63c874f452/html5/thumbnails/13.jpg)
Compute Cloud
• Infrastructure as a service
• Soft and hardware catalog
• On demand machines• Priced per hour
![Page 14: Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional complexity Configuration complexity T h o u g h t a n d E f f o r t. ... • as easy as](https://reader033.vdocument.in/reader033/viewer/2022052001/601416c99d5e9b63c874f452/html5/thumbnails/14.jpg)
Face meets palm
• Deal with Errors
• Deal with Constant Updates
• Deal with Complexity
![Page 15: Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional complexity Configuration complexity T h o u g h t a n d E f f o r t. ... • as easy as](https://reader033.vdocument.in/reader033/viewer/2022052001/601416c99d5e9b63c874f452/html5/thumbnails/15.jpg)
jclouds
• Open source (github jclouds/jclouds)
• Feels like java (and clojure)
• Portability between clouds• Unit testable
• Strong ecosystem
![Page 16: Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional complexity Configuration complexity T h o u g h t a n d E f f o r t. ... • as easy as](https://reader033.vdocument.in/reader033/viewer/2022052001/601416c99d5e9b63c874f452/html5/thumbnails/16.jpg)
Java overview
// initcontext = new ComputeServiceContextFactory(). createContext("gogrid", apikey, secret, singleton(new JschSshClientModule()));
compute = context.getComputeService();
// create a couple nodes and open a couple portsnodes = compute.runNodesWithTag(“web-prod”, 2, runScript(bootstrap). InboundPorts(22, 8080));
// gather my ip addressesfor (NodeMetadata node : nodes) { node.getPublicAddresses(); node.getPrivateAddresses();}
![Page 17: Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional complexity Configuration complexity T h o u g h t a n d E f f o r t. ... • as easy as](https://reader033.vdocument.in/reader033/viewer/2022052001/601416c99d5e9b63c874f452/html5/thumbnails/17.jpg)
Clojure overview
(with-compute-service [“trmk-vcloudexpress” email pass :ssh] (def nodes (run-nodes “web-prod” 2 (build-template compute :inbound-ports [22,8080] :run-script bootstrap))) (pprint nodes))
![Page 18: Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional complexity Configuration complexity T h o u g h t a n d E f f o r t. ... • as easy as](https://reader033.vdocument.in/reader033/viewer/2022052001/601416c99d5e9b63c874f452/html5/thumbnails/18.jpg)
Who's integrating?
Whirr...
![Page 19: Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional complexity Configuration complexity T h o u g h t a n d E f f o r t. ... • as easy as](https://reader033.vdocument.in/reader033/viewer/2022052001/601416c99d5e9b63c874f452/html5/thumbnails/19.jpg)
What's next?
• Mounted volume support
• Existing node management
• Cloning / Backups
![Page 20: Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional complexity Configuration complexity T h o u g h t a n d E f f o r t. ... • as easy as](https://reader033.vdocument.in/reader033/viewer/2022052001/601416c99d5e9b63c874f452/html5/thumbnails/20.jpg)
DEMO
Multi Threaded integration tests against a pool of cloud
nodes
![Page 21: Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional complexity Configuration complexity T h o u g h t a n d E f f o r t. ... • as easy as](https://reader033.vdocument.in/reader033/viewer/2022052001/601416c99d5e9b63c874f452/html5/thumbnails/21.jpg)
Open Discussion
![Page 22: Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional complexity Configuration complexity T h o u g h t a n d E f f o r t. ... • as easy as](https://reader033.vdocument.in/reader033/viewer/2022052001/601416c99d5e9b63c874f452/html5/thumbnails/22.jpg)
Get involved!
• Participate with us!
– Share ideas on the forums (or IRC)
– Give us feedback on releases – still in alpha!
• Fork us!
– http://github.com/arquillian
• Meet us!
– #jbosstesting channel on irc.freenode.net
• Write for us!
– Share your stories – Blog! Tweet!
– Document how it works
![Page 23: Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional complexity Configuration complexity T h o u g h t a n d E f f o r t. ... • as easy as](https://reader033.vdocument.in/reader033/viewer/2022052001/601416c99d5e9b63c874f452/html5/thumbnails/23.jpg)
Hackfest
Join the fun