Debugging Flexmojos testharnes tests

Define which tests to run

Sometimes it is rather inconvenient to have all tests in the testharnes.

In order to explicitly run one individual test I usually rename the corresponding Test class to have a prefix that is different from the default "Test". Usually I rename it to something "TestDebug". After this you have to confiugre the surefire plugin to only execute "*TestDebug" tests. This is done in by the following configuration in the testharnes pom.

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <properties>
            <property>
              <name>listener</name>
              <value>net.flexmojos.oss.test.ProgressListener</value>
            </property>
          </properties>
          <includes>
            <include>**/*TestDebug.java</include>
          </includes>
        </configuration>
      </plugin>

I guess I don't have to mention to rename the class back after you are finished and to revert the settings of the sur

Enable breakpoints in the test code

In the testsuite a lot of process forking is done, so simply starting the maven build as debug build will probably only enable you to set breakpoints in the builds plugins.

By providing the following commandline parameter to maven and starting the build with a debug profile, the IDE is able to stop at breakpoints in the Unit tests of Flexmojos.

-DforkMode=never

This however doesn't allow you to set breakpoints in the unit-tests of projects being built by one of the testcases, as these are executed via a separate Maven instance created by the testcases.