[infinispan-dev] PSA: How to debug an integration test

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[infinispan-dev] PSA: How to debug an integration test

Dan Berindei
I had to debug some JMX stuff today and I remembered that Gustavo wanted a guide for debugging ITs, so here goes:

1. Build the server

mvn install -DskipTests -am -pl server/integration/testsuite

2. Unpack the server in the testsuite module

mvn test -pl server/integration/testsuite

3. Try to run the IT from the IDE, it should fail because it can't find the server definition

4. Check the @RunningServer references at the top of the IT and search for them in arquillian.xml. E.g. JmxManagementIT uses "jmx-management-1", which is defined under

<group qualifier="suite-manual">

5. Add -Darquillian.launch=<group qualifier> to your debug configuration

6. Your test should run now. I got an error about env.JAVA_HOME not being defined, I just added a JAVA_HOME environment variable in the debug configuration and it worked.

The Arquillian server configuration may need other system properties. IntelliJ automatically picks up the system properties set in the failsafe execution [1] when it imports the project, but you may have to set them manually in your debug configuration.

Now that the test runs, we can try to debug the server.

7. Define a remote debug configuration. Preferably is should be in listen mode: IntelliJ 2018.3.Beta1+ can automatically restart listening after a debug session is over, so you only have to start the remote debug configuration once.

8. Search for the server in arquillian.xml again and add the connection string from the remote debug configuration, e.g.

        <container qualifier="jmx-management-1" mode="manual">
            <configuration>
                ...
                <property name="javaVmArguments">
                   ....
                   -agentlib:jdwp=transport=dt_socket,server=n,address=localhost:5005

9. Set a breakpoint in the server and start the test debug configuration. Your remote debug session should stop at the breakpoint.

HTH
Dan


_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev
Reply | Threaded
Open this post in threaded view
|

Re: [infinispan-dev] PSA: How to debug an integration test

Galder Zamarreno
Thanks Dan!!

On Wed, Nov 21, 2018 at 5:14 PM Dan Berindei <[hidden email]> wrote:
I had to debug some JMX stuff today and I remembered that Gustavo wanted a guide for debugging ITs, so here goes:

1. Build the server

mvn install -DskipTests -am -pl server/integration/testsuite

2. Unpack the server in the testsuite module

mvn test -pl server/integration/testsuite

3. Try to run the IT from the IDE, it should fail because it can't find the server definition

4. Check the @RunningServer references at the top of the IT and search for them in arquillian.xml. E.g. JmxManagementIT uses "jmx-management-1", which is defined under

<group qualifier="suite-manual">

5. Add -Darquillian.launch=<group qualifier> to your debug configuration

6. Your test should run now. I got an error about env.JAVA_HOME not being defined, I just added a JAVA_HOME environment variable in the debug configuration and it worked.

The Arquillian server configuration may need other system properties. IntelliJ automatically picks up the system properties set in the failsafe execution [1] when it imports the project, but you may have to set them manually in your debug configuration.

Now that the test runs, we can try to debug the server.

7. Define a remote debug configuration. Preferably is should be in listen mode: IntelliJ 2018.3.Beta1+ can automatically restart listening after a debug session is over, so you only have to start the remote debug configuration once.

8. Search for the server in arquillian.xml again and add the connection string from the remote debug configuration, e.g.

        <container qualifier="jmx-management-1" mode="manual">
            <configuration>
                ...
                <property name="javaVmArguments">
                   ....
                   -agentlib:jdwp=transport=dt_socket,server=n,address=localhost:5005

9. Set a breakpoint in the server and start the test debug configuration. Your remote debug session should stop at the breakpoint.

HTH
Dan

_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev

_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev