本文介绍了调试JBehave场景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在调试jbehave测试时遇到问题。我不能让maven开始jbehave测试并在断点处停下来。我在我的pom中有这个:

I'm having trouble debugging my jbehave tests. I cannot get maven to start the jbehave tests and stop at a breakpoint. I have this in my pom:

<pluginManagement>
 <plugins>
   <plugin>
     <groupId>org.jbehave</groupId>
     <artifactId>jbehave-maven-plugin</artifactId>
     <version>2.0.1</version>
   </plugin>
 </plugins>
</pluginManagement>
<plugins>
 <plugin>
   <groupId>org.jbehave</groupId>
   <artifactId>jbehave-maven-plugin</artifactId>
   <executions>
     <execution>
       <id>run-scenarios-found</id>
       <phase>test</phase>
       <configuration>
         <scenarioIncludes>
           <scenarioInclude>**/scenario/**/*${test}.java</scenarioInclude>
         </scenarioIncludes>
         <scenarioExcludes>
           <scenarioExclude>**/*Steps.java</scenarioExclude>
         </scenarioExcludes>
       </configuration>
       <goals>
         <goal>run-scenarios</goal>
       </goals>
     </execution>
   </executions>
 </plugin>
</plugins>

我尝试过这样的事情:

$  mvn -e -o -Dtest=MyTest -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8787 -Xnoagent -Djava.compiler=NONE" clean test

$ export MVN_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8787 -Xnoagent -Djava.compiler=NONE" ; mvn -Dtest=MyTest clean test 

我可以尝试使用,但我可能需要完美无暇的时间自动化,所以听起来像一个次优的解决方案,我觉得JBehave Maven插件应该提供这个功能。显然,我还没有找到合适的文件。我有什么想法吗?

I can try to use jsadebugd, but I that will probably require immaculate timing to automate, so that sounds like a suboptimal solution, and I feel like the JBehave Maven plugin should provide this functionality. Clearly I have just not found the right piece of documetation yet. Any ideas how I go about this ?

推荐答案

以下对我有用:
export MAVEN_OPTS = - Xdebug - Xrunjdwp:transport = dt_socket,server = y,suspend = y,address = 8787 -Xnoagent -Djava.compiler = NONE

The following worked for me:export MAVEN_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8787 -Xnoagent -Djava.compiler=NONE"

然后开始我的mvn测试:
mvn install

then start my mvn tests:mvn install

(maven现在挂起等待调试器连接)

(maven now hangs waiting for the debugger to connect)

然后在远程启动Eclipse调试会话,指向本地主机,端口8787(如上所示),并设置适当的断点。

Then start Eclipse in a remote debug session, pointing at local host, port 8787 (as above), with appropriate breakpoints set.

这篇关于调试JBehave场景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 18:20