How can I debug test cases run by Tycho?
Asked Answered
S

2

10

When using Tycho to build a project, the test cases are run in a new process using the equinox launcher to run -application org.eclipse.tycho.surefire.osgibooter.headlesstest.

How can I debug the test cases?

Spectator answered 15/3, 2012 at 12:56 Comment(0)
C
8

There is a much easier way to accomplish this:

just add -DdebugPort=8000 to your Maven commandline and attach a remote debug session.

See the docs https://www.eclipse.org/tycho/sitedocs/tycho-surefire-plugin/test-mojo.html#debugPort

Christal answered 16/3, 2012 at 8:34 Comment(0)
S
5

Add this to your 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>

Now you can enable debugging with mvn ... -P debug when the following line is printed:

Listening for transport dt_socket at address: 8000

See the Eclipse help how to configure the IDE.

Spectator answered 15/3, 2012 at 12:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.