Mar*_*Nuc 9 java junit unit-testing jboss-arquillian jboss7.x
我有Java EE项目,我在JBoss 7(Windows)上使用JUnit进行Arquillian测试.测试工作正常,但我无法调试它们.
从我用Google搜索(https://community.jboss.org/wiki/WhyDontBreakPointsWorkWhenDebugging)我知道Arquillian测试正在单独的VM中运行,因此IntelliJ无法调试它们.我需要IntelliJ通过socket远程连接到那台机器,但我不知道该怎么做.
我找到了这个帖子:在IntelliJ中使用Arquillian进行调试 - 托管容器但是我不知道如何让它工作.
我也跨过了这个帖子:http://devnet.jetbrains.com/message/5253623?tstart = 0所以我希望在我的pom.xml中填充appropriet surefire部分,但它没有帮助:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<debugForkedProcess>true</debugForkedProcess>
<skip>false</skip>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
请问有人如何在这样的配置中调试测试吗?
首先取决于您使用的容器类型 - 托管,远程或嵌入式.另见https://docs.jboss.org/author/display/ARQ/Containers.对于后者,测试在同一JVM中运行,您可以直接在IDE中调试测试.
在这种情况下,Surefire配置并不重要,因为您希望在IDE中进行调试(除非您在IDE中执行maven目标).
对于托管和远程容器,您需要调试实际容器.为此,您必须将正确的JVM选项传递给远程容器,以便您可以打开远程调试会话.一种方法是通过arquillian.xml:
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<!-- Need to set the default protocol and use resource filtering, because of https://issues.jboss.org/browse/ARQ-579 -->
<defaultProtocol type="Servlet 3.0"/>
<engine>
<property name="deploymentExportPath">target/artifacts</property>
</engine>
<container qualifier="incontainer">
<configuration>
<property name="jbossHome">${jbossTargetDir}</property>
<property name="javaVmArguments">-Xmx1024m -XX:MaxPermSize=512m -Xnoagent -Djava.compiler=NONE -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005</property>
<property name="allowConnectingToRunningServer">true</property>
</configuration>
</container>
Run Code Online (Sandbox Code Playgroud)
上面例子中的重要部分是javaVmArguments.
| 归档时间: |
|
| 查看次数: |
7176 次 |
| 最近记录: |