【问题标题】:How can I debug test cases run by Tycho?如何调试 Tycho 运行的测试用例?
【发布时间】:2012-03-31 23:40:24
【问题描述】:

当使用 Tycho 构建项目时,测试用例在新进程中运行,使用 Equinox 启动器运行 -application org.eclipse.tycho.surefire.osgibooter.headlesstest

如何调试测试用例?

【问题讨论】:

    标签: java remote-debugging tycho tycho-surefire-plugin


    【解决方案1】:

    有一种更简单的方法可以做到这一点:

    只需将-DdebugPort=8000 添加到您的 Maven 命令行并附加远程调试会话。

    请参阅文档https://www.eclipse.org/tycho/sitedocs/tycho-surefire-plugin/test-mojo.html#debugPort

    【讨论】:

      【解决方案2】:

      将此添加到您的 POM:

      <profiles>
          <profile>
              <id>debug</id>
      
              <build>
                  <plugins>
                      <plugin>
                          <groupId>org.eclipse.tycho</groupId>
                          <artifactId>tycho-surefire-plugin</artifactId>
                          <version>${tycho-version}</version>
                          <configuration>
                             <argLine>-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y</argLine>
                          </configuration>
                      </plugin>
                  </plugins>
              </build>
          </profile>
      </profiles>
      

      现在您可以在打印以下行时使用mvn ... -P debug 启用调试:

      在地址:8000 监听传输 dt_socket

      请参阅Eclipse help how to configure the IDE

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-11-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-08-07
        • 1970-01-01
        • 2012-06-18
        相关资源
        最近更新 更多