23 December 2018

In this post and this post I have described how to Chameleon can continously simplify the usage of Arquillian. What still was missing is the option for Arquillian to build the artifact/WAR with Gradle itself and use it for the test/deployment. Some time ago I gave it a shot to implement the @GradleBuild-annotation similar to the existing @MavenBuild-annotation. It took some time until my commit made it into an official release-candidate; but here are the steps how you can make use of it.

Here, I am only listing the updated dependencies for Chameleon:

dependencies {
    testCompile 'org.arquillian.container:arquillian-chameleon-junit-container-starter:1.0.0.CR4'
    testCompile 'org.arquillian.container:arquillian-chameleon-gradle-build-deployment:1.0.0.CR4'

Now you can make use of @GradleBuild. It will trigger the Gradle-build via the Tooling-API and use the artifact under build/libs as deployment for the test.

@ChameleonTarget(value = "wildfly:11.0.0.Final:managed")
public class HelloServiceIT {

    private HelloService service;

    public void shouldGreetTheWorld() throws Exception {
        Assert.assertEquals("hello", service.hello());