Arquillian Spock TestRunner
Latest commit 24bc28b Aug 20, 2016 @bartoszmajsak bartoszmajsak committed on GitHub Changes links in the
Spock refers now to the documentation
Arquillian to the official page
Failed to load latest commit information.
container Fixes deprecation warnings about TestResult. Jul 5, 2016
examples Fixes deprecation warnings about TestResult. Jul 5, 2016
.gitignore Updated gitignore to not track autoenv files Apr 17, 2016

Spock Arquillian Extension

BDD Testing in the container!

What is it?

Arquillian is testing framework, developed at, that empowers developers to write integration tests for business objects that are executed inside of an embedded or remote container--options include a servlet container, a Java EE application server or a Java SE CDI environment.

Spock is a testing and specification framework for Java and Groovy applications. What makes it stand out from the crowd is its beautiful and highly expressive specification language. Thanks to its JUnit runner, Spock is compatible with most IDEs, build tools, and continuous integration servers. Spock is inspired from JUnit, jMock, RSpec, Groovy, Scala, Vulcans, and other fascinating life forms.

The Spock Arquillian Extension opens up for the beauty of Spock tests running in-container using Arquillian with full EJB, Resource and CDI injection.


 def static JavaArchive "create deployment"() {
     return ShrinkWrap.create(JavaArchive.class)
             .addClasses(AccountService.class, Account.class, SecureAccountService.class)
             .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

 AccountService service

 def "transferring between accounts should result in account withdrawal and deposit"() {
      service.transfer(from, to, amount)

      from.balance == fromBalance
      to.balance == toBalance

      from <<         [new Account(100),  new Account(10)]
      to <<           [new Account(50),   new Account(90)]
      amount <<       [50,                10]
      fromBalance <<  [50,                0]
      toBalance <<    [100,               100]


The Spock Arquillian Extension supports both Groovy major versions supported by Spock Framework. In order to select proper versions, you need to put following dependencies into your section:

     <!-- replace * with standalone or container, according to your needs -->

 <!-- External Projects -->


For Groovy 2.x, use spock 0.7-groovy-2.0 or later and Groovy 2.1.4 or later For Groovy 1.x, use spock 0.7-groovy-1.8 or later and Groovy 1.8.9 or later

You must annotate the JUnit Runner with the ArquillianSputnik runner.


Contents of repository

core/ The Spock Extension.

standalone/ Standalone Arquillian test executor.

container/ Container extension which bundles all Spock-related dependencies required while running Spock specifications using Arquillian.

examples/ Sample tests written using Spock BDD framework.


This distribution, as a whole, is licensed under the terms of the Apache License, Version 2.0 (see license.txt).

More info

Spock Arquillian