The configureArquillian
task is used to easily integrate Arquillian and the Arquillian Liberty Managed and Remote containers with your existing Liberty project. It provides two major advantages:
- The ability to set
arquillian.xml
container properties directly within thebuild.gradle
. - Automatic generation of
arquillian.xml
when using the Arquillian Liberty Managed container.
For more convenient integration with the Arquillian Liberty Managed/Remote containers and JUnit/TestNG, you can use this task with the Arquillian Liberty Dependency Bundles.
Notice: Be aware of false positive test results when using certain versions of TestNG with Arquillian. More information can be found here.
For both Arquillian Liberty Managed and Remote containers, the configureArquillian
task can automatically generate and configure the arquillian.xml
that usually exists in the src/test/resources
directory, eliminating the need for the user to manually create the file in projects with only a single Arquillian container.
Furthermore, when using the Arquillian Liberty Managed container, configureArquillian
will also automatically specify the three required configuration parameters: wlpHome
, serverName
, and httpPort
. These are set to values specified in the liberty-gradle-plugin
.
The configureArquillian
task will perform configuration for the Liberty Managed or Remote container based on which container exists on the classpath. Arquillian does not allow for more than one container on the classpath. In the event of neither container existing on the classpath, the configureArquillian
task will default to providing configuration for the Liberty Managed container.
configureArquillian
depends on deploy
and processTestResources
.
Here is a list of common configuration parameters for the Arquillian Liberty Managed and Remote configurations:
Property | Type | Description | Default |
---|---|---|---|
arquillianProperties |
Dictionary | Used to set key/value pairs of configuration parameters in arquillian.xml . |
Managed: A dictionary containing values for wlpHome , serverName , and httpPort as specified in the liberty-gradle-plugin .Remote: An empty dictionary when using the Arquillian Liberty Remote container. |
skipIfArquillianXmlExists |
Boolean | Skips the configureArquillian task if arquillian.xml already exists in the build directory. |
False |
For documentation of the Liberty Arquillian Containers, please see the following links:
This is an example of using configureArquillian
in a Managed container environment. Specify the following tasks below the liberty
closure in your build.gradle
. The properties used by configureArquillian
are set inside of the arquillianConfiguration
extension:
arquillianConfiguration {
arquillianProperties = ['outputToConsole': 'true']
skipIfArquillianXmlExists = true
}
test {
reports.html.destination = file("$buildDir/reports/it")
reports.junitXml.destination = file("$buildDir/test-results/it")
include '**/*IT*'
exclude '**/unit/**'
testLogging.showStandardStreams = true
dependsOn 'deploy', 'testClasses', 'configureArquillian'
}
Note that test
depends on configureArquillian
to ensure that the arquillian.xml
will be generated before integration tests are run.
You can verify that the arquillian.xml
is being generated properly by viewing it at build/resources/test/arquillian.xml
. You'll know that the file was generated by the configureArquillian
task if the following comment is at the end of the file:
<!-- This file was generated by the Liberty build plugin. -->