How to setup Arquillian testing with Wildfly
This tutorial requires: Knowledge with GIT Knowledge with archetype Requirements: Wildfly eclipse What to do: In eclipse c...
https://www.czetsuyatech.com/2017/04/wildfly-arquillian-testing.html
This tutorial requires:
- Knowledge with GIT
- Knowledge with archetype
Requirements:
- Wildfly
- eclipse
What to do:
- In eclipse create a new maven project: File->New->Other, enter maven in the filter. Select Maven Project.
- Click next, then next. In the filter enter "javaee". Select wildfly-javaee7-webapp-archetype.
- Click next, enter group and artifact id.
- Click finish. Your project should be created.
- Open arquillian.xml in src/test/resources. Uncomment configuration section and set the jbossHome property:
<?xml version="1.0" encoding="UTF-8"?> <arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> <!-- Force the use of the Servlet 3.0 protocol with all containers, as it is the most mature --> <defaultProtocol type="Servlet 3.0" /> <!-- Example configuration for a remote WildFly instance --> <container qualifier="wildfly" default="true"> <!-- By default, arquillian will use the JBOSS_HOME environment variable. Alternatively, the configuration below can be uncommented. --> <configuration> <property name="jbossHome">C:\java\jboss\wildfly-10.1.0.Final</property> <!-- <property name="javaVmArguments">-Xmx512m -XX:MaxPermSize=128m --> <!-- -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y --> <!-- </property> --> </configuration> </container> <engine> <property name="deploymentExportPath">target/deployments</property> </engine> </arquillian>
- Then in your terminal, go to your project directory and run:
>mvn clean test -Parq-wildfly-managed
>This run arquillian test using wildfly managed container.
It's actually a straightforward process. The tricky part is creating your test war. Open MemberRegistrationTest, to see what I mean. Sometimes it's useful to include an archive with all its dependencies than including one class at a time.
Post a Comment