Skip to content
This repository was archived by the owner on May 21, 2019. It is now read-only.

Debug Cuke4Duke Steps

aslakhellesoy edited this page Sep 13, 2010 · 18 revisions

Remote debugging

To use enable debugging within cuke4duke is really easy.

All you have to do is to enable remote debugging in the JVM using this jvm options:

-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=4000

When you run cuke4duke (e.g. with maven or ant) this message will appear in the terminal:

Listening for transport dt_socket at address: 4000

All you have to do now is to place breakpoints in the code and launch the debugger.

Using Maven

If you’re using Maven the jvm options could be added in two ways:

Add MAVEN_OPTS

MAVEN_OPTS="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=4000";
export MAVEN_OPTS

Add a jvmArg to the pom.xml


<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>
      ....

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>

Clone this wiki locally