Skip to content

COLA Instrumentation

Bruno Santos edited this page Jan 7, 2016 · 2 revisions

COLA Tests can be enabled through Java instrumentation. Instrumentation will inject the JUnit test methods at runtime. Because of this it does not require cola-maven-plugin or cola-gradle-plugin for maven or gradle, respectively.

Maven example

To enable COLA Tests in Maven Surefire of Failsafe plugins, just add <argLine>-javaagent:/path/to/cola-tests-x.x.x.jar</argLine> to their configuration.

An example setup for Surefire is shown below:

...
    <properties>
        <cola.version>0.4.0</cola.version>
        <cola.agent>${settings.localRepository}/com/github/bmsantos/cola-tests/${cola.version}/cola-tests-${cola.version}.jar</cola.agent>
    </properties>
...
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.18.1</version>
                <configuration>
                    <argLine>-javaagent:${cola.agent}</argLine>
                </configuration>
            </plugin>
...

See example here

Gradle

If using the Java plugin, just set the test jvmArgs:

test {
    jvmArgs '-javaagent:/path/to/com/github/bmsantos/cola-tests/0.4.0/cola-tests-0.4.0.jar'
}

See example here

Kobalt

test {
    jvmArgs("-javaagent:" + homeDir(".kobalt/repository/com/github/bmsantos/cola-tests/0.5.0/cola-tests-0.5.0.jar"))
}