Rethinking the integration test

If you think doing integration testing is significantly slower, complex or just plain harder than unit testing, think again. In this video, Aslak shows how quickly you can go from an empty directory (0mph) to a project that runs a CDI test inside a managed JBoss AS 7 container (60mph) in under a minute using the Arquillian plugin for JBoss Forge.

Notice that the test cold boots JBoss AS 7, deploys the tests and runs it in-container, then undeploys and shuts down the server in < 5 seconds. (It runs even faster when you take away the Maven cycle).

A quote by Brian Leathem is suitable for quoting here:

With tools like Arquillian, Shrinkwrap, [and] in-memory databases, [we] are busting through the old barriers of terms like unit and integration tests. Perhaps we need a new term for them: “real tests” or “useful tests” are two possibilities that come to mind.

Don’t mock. Test for real.