Skip to content

Instantly share code, notes, and snippets.

@vprusa
Last active April 4, 2020 13:07
Show Gist options
  • Save vprusa/a45a75ec4c1c2ed330803c021f01cd92 to your computer and use it in GitHub Desktop.
Save vprusa/a45a75ec4c1c2ed330803c021f01cd92 to your computer and use it in GitHub Desktop.
Notes on debugging Arquillian tests on Wildfly (for IntelliJ IDEA)

Testing notes

Notes for debugging Arquillian tests using IDEA

Tests are running on container

At dir ./

1. Start and wait for loading of WS in debug mode

./wildfly-home/bin/standlone.sh --debug

2. (optional) deploy app

mvn wildfly:undeploy install wildfly:deploy -DskipTests=true -Dcheckstyle.skip | tee app.log

3. In IDEA Run start Debug configuration named 'local debug test' Configuration name may be changed and it is 'Remote' configuration on module services with properties:

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8787

with output

Connected to the target VM, address: 'localhost:8787', transport: 'socket'

4. In IDEA Run start Debug configuration named 'debug tests' Configuration name may be changed and it is 'maven' configuration with working directory ./services

test -Dtest=ExampleTest -Dcheckstyle.skip "-Dmaven.surefire.debug=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8787 -Xnoagent -Djava.compiler=NONE"

with output

Connected to the target VM, address: '127.0.0.1:56715', transport: 'socket'
[INFO] ...
# ... log messages
Listening for transport dt_socket at address: 8787

(IDEA wrapper for execution of mvn)

This step with its command may not work for the first time so try it again.

5. After debug console shows 'Listening for incoming communication on port 8787' (or something like that) in dir ./services/ execute:

mvn test -Dtest=RecognitionTest -Dcheckstyle.skip | tee app.log

which will connect to opened port 8787 and debugging is running and prepared for Stepping (F9,F8,F7 ...)

6. It may happen that previous run kept ports opened and so it is necessary to close them

ps -fe | grep Xdebug
pkill -9 -f Xdebug

Afterwards it may be necessary to restart wildfly...

Personal End Note:

I was kind of puzzled why step 3. has to be used, but I guess it prepares communication link between WF debug mode and steps 4. or/and 5. or something like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment