Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

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>

Enable breakpoints in the test code

In the testsuite a lot of process forkin is done, so simply starting the maven build as debug build will probably only enable you to set breakpoints in the builds plugins. But this is not what we want.

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.

  • No labels