Thursday, April 25, 2013

Tips - Remote Debug with Maven 3 - Test-cases

How To Debug Test-cases with Maven at maven run time

1) Open your Project with your favorite IDE ( eclipse, intellij IDEA etc) and set break points that you are going to debug.

2) Build the project using following parameters

$mvn clean install -Dmaven.surefire.debug

3) It starts to build your project and it will stop at test cases.

[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ org.wso2.bps.integration.tests ---
[INFO] Compiling 41 source files to /data/source/branch/carbon410/platform/products/bps/3.0.2/modules/integration/org.wso2.bps.integration.tests/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12:test (default-test) @ org.wso2.bps.integration.tests ---
[INFO] Surefire report directory: /data/source/branch/carbon410/platform/products/bps/3.0.2/modules/integration/org.wso2.bps.integration.tests/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Listening for transport dt_socket at address: 5005



4) Start remote debug on port 5005 using your IDE. It will trigger the build process with remote debug.


Source : http://maven.apache.org/surefire/maven-surefire-plugin/examples/debugging.html