Arquillian Forge Addon
Setting up an Arquillian profile & Test Framework
Arquillian supports testing in multiple containers. This is done by using a Maven profile for each container. This makes it possible to have multiple containers configured side-by-side too. To add a new profile you use the arquillian setup command:
arquillian-setup
This command will prompt for which testframework to use, do you want to use standalone mode, if not then which container to use.
If you need to install an additional container profile, run command:
arquillian-add-container
In above command if selected container is supported by chameleon then it is configured using chameleon, otherwise it will add required container adapter to setup container.
If container is not supported by chameleon, Forge will download it for you. There is no need to download container manually.
Note: We are no longer supporting container prior to JBoss AS 7 in forge.
Tomcat Container Configuration
In case of Tomcat container, if you are trying to set it up in managed mode. Forge will create custom server.xml depending on tomcat version, tomcat-users.xml which contains users with manager-script
role. So after successful execution of command, chameleon is configured with required resources & properties, Tomcat is ready to use. No worries about configuration.
It will only work if catalina.home
is nested in the target folder.(For chameleon default download folder for container distributions is target/
for Maven).
Generating tests
Writing Arquillian tests is trivial, and is documented well: https://docs.jboss.org/author/display/ARQ/Reference+Guide
Forge can help you get started however.
arquillian-create-test --targets demo.CoolBean --archiveType JAR
Of course you can use the TAB key to navigate to the class that you want to test.
Arquillian Cube
Setup:
To add Arquillian Cube dependencies configuration options in arquillian.xml, run command:
arquillian-cube-setup --type docker-compose --file-path docker-compose.yml
Before running above command make sure that file provided with file-path is exists.
Create Test:
To create a test class, run command:
arquillian-create-test --named MyDockerComposeTest --target-package org.arquillian.cube
.
Add Cube Test & Enrichers:
To enrich a given Arquillian test with respective annotations depending on selected type, run command:
arquillian-cube-add-test --test-class org.cube.docker.MyDockerComposeTest
Same way you can create a test for Kubernetes, Docker, Openshift.
All Available Commands
Name |
Usage |
|
arquillian-setup |
To setup container, and add test framework dependency. |
|
arquillian-add |
To add arquillian universe bom dependency |
|
arquillian-add-testframework |
To add testframework dependency. |
|
arquillian-container-setup |
To add required dependency for container to setup. |
|
arquillian-container-configuration |
To configure container configuration. |
|
arquillian-create-test |
To create a test inside package. |
|
arquillian-cube-setup |
To add arquillian cube dependency & updates arquillian configuration. |
|
arquillian-cube-add-test |
To add a test method in selected class with required test enricher depending on selected type. |
For more details about options have a look into integration tests at: integration tests