Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional...

Post on 27-Sep-2020

1 views 0 download

Transcript of Frictionless integration - JBoss · Unit Tests Integration Tests Functional Tests Functional...

Frictionless integration testing in the Cloud

Adrian Cole Aslak Knutsen

Arquillianjclouds

Agenda

• Introduction

• Arquillian• jclouds

• Demo• Open Discussion

Why don't we test?

The “testing bandgap” and compounding effort

Unit Tests Integration Tests Functional Tests

Functional complexity

Configuration complexity

Tho

ught

and

Eff

ort

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

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

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

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

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

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")); }}

jclouds

• Adrian Cole (@jclouds)

• Founded jclouds last march

• Contributor on many cloud programs

Compute Cloud

• Infrastructure as a service

• Soft and hardware catalog

• On demand machines• Priced per hour

Face meets palm

• Deal with Errors

• Deal with Constant Updates

• Deal with Complexity

jclouds

• Open source (github jclouds/jclouds)

• Feels like java (and clojure)

• Portability between clouds• Unit testable

• Strong ecosystem

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();}

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))

Who's integrating?

Whirr...

What's next?

• Mounted volume support

• Existing node management

• Cloning / Backups

DEMO

Multi Threaded integration tests against a pool of cloud

nodes

Open Discussion

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

Hackfest

Join the fun