-
Notifications
You must be signed in to change notification settings - Fork 72
Debug Cuke4Duke Steps
To enable debugging within the cuke4duke steps is just as easy as for the cuke4duke maven plugin.
All you have to do is to set up a remote debugger configuration in Eclipse connecting to port 4000 (or another port of your liking).
In your pom.xml file you have to add a debug <jvmArg>
element within the cuke4duke-maven-plugin configuration.
<plugin>
<groupId>cuke4duke</groupId>
<artifactId>cuke4duke-maven-plugin</artifactId>
<version>0.1.9</version>
<configuration>
<jrubyHome>${env.JRUBY_HOME}</jrubyHome>
<jvmArgs>
<jvmArg>-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=4000 -Xdebug</jvmArg>
....
Then run the actual mvn command, e.g.:
mvn cuke4duke:cucumber
This message will appear in the terminal:
Listening for transport dt_socket at address: 4000
All you have to do now is to place your breakpoints in the code, launch the debug configuration and the debugger will stop at your first breakpoint.
Another alternative could be to replace the <jvmArg>
with a property, <jvmArg>${cucumber.debug}</jvmArg>
, that’s declared empty, but overridden by a maven profile.
<profile>
<id>cukes_debug</id>
<activation>
<property>
<name>env</name>
<value>cukes_debug</value>
</property>
</activation>
<properties>
<cucumber.debug>-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=4000 -Xdebug</cucumber.debug>
</properties>
</profile>