Changeset 19682 in josm for trunk/pom.xml


Ignore:
Timestamp:
2026-11-10T16:32:36+01:00 (2 hours ago)
Author:
gaben
Message:

Compile and run functional and performance tests with Maven

The functional and performance surefire executions only set testSourceDirectory, which surefire does not compile, so they ran the unit tests again. Compile test/functional and test/performance into their own class directories against the unit test classes and run them from there, like ant test-compile and call-junit do.

Also align the test runs with Ant:

  • drop the duplicate default-tests execution
  • let the TestIT executions override the inherited TestIT exclude, so unit and functional integration tests actually run
  • only pick up /*Test classes, like Ant's default-junit-includes
  • use a separate josm.home per test family
  • skip performance tests unless -DskipPerformanceTests=false
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pom.xml

    r19664 r19682  
    4343    <!-- Needed just in case something adds argLine for tests before we set it -->
    4444    <argLine/>
     45    <!-- Like `ant test-perf`, performance tests only run on request: -DskipPerformanceTests=false -->
     46    <skipPerformanceTests>true</skipPerformanceTests>
    4547  </properties>
    4648  <packaging>jar</packaging>
    … …  
    494496        </executions>
    495497      </plugin>
    496       <!-- Configure the test plugin, specifically enable autodetection of global extensions -->
     498      <!-- Compile test/functional and test/performance against the unit test classes, like `ant test-compile` -->
     499      <plugin>
     500        <groupId>org.apache.maven.plugins</groupId>
     501        <artifactId>maven-compiler-plugin</artifactId>
     502        <executions>
     503          <execution>
     504            <id>functional-test-compile</id>
     505            <phase>test-compile</phase>
     506            <goals>
     507              <goal>testCompile</goal>
     508            </goals>
     509            <configuration>
     510              <compileSourceRoots>
     511                <compileSourceRoot>${test.dir}/functional</compileSourceRoot>
     512              </compileSourceRoots>
     513              <outputDirectory>${project.build.directory}/functional-test-classes</outputDirectory>
     514            </configuration>
     515          </execution>
     516          <execution>
     517            <id>performance-test-compile</id>
     518            <phase>test-compile</phase>
     519            <goals>
     520              <goal>testCompile</goal>
     521            </goals>
     522            <configuration>
     523              <compileSourceRoots>
     524                <compileSourceRoot>${test.dir}/performance</compileSourceRoot>
     525              </compileSourceRoots>
     526              <outputDirectory>${project.build.directory}/performance-test-classes</outputDirectory>
     527            </configuration>
     528          </execution>
     529        </executions>
     530      </plugin>
     531      <!-- Configure the test plugin, specifically enable autodetection of global extensions.
     532           `mvn test` runs the unit tests (default-test, like `ant test-unit`); `mvn integration-test` also runs
     533           the functional tests and the unit/functional *TestIT (like `ant test` and `ant test-it`). -->
    497534      <plugin>
    498535        <artifactId>maven-surefire-plugin</artifactId>
    499536        <configuration>
     537          <includes>
     538            <include>**/*Test</include>
     539          </includes>
    500540          <excludes>
    501541            <exclude>**/*TestIT</exclude>
    … …  
    527567          </properties>
    528568          <systemPropertyVariables>
    529             <josm.home>${test.dir}/config/josm.home</josm.home>
     569            <josm.home>${test.dir}/config/unit-josm.home</josm.home>
    530570            <josm.test.data>${test.dir}/data</josm.test.data>
    531571            <java.awt.headless>${test.headless}</java.awt.headless>
    … …  
    537577        <executions>
    538578          <execution>
    539             <id>default-tests</id>
    540             <phase>test</phase>
     579            <id>unit-it-tests</id>
     580            <phase>integration-test</phase>
    541581            <goals>
    542582              <goal>test</goal>
    543583            </goals>
    544           </execution>
    545           <execution>
    546             <id>integration-tests</id>
    547             <phase>integration-test</phase>
    548             <goals>
    549               <goal>test</goal>
    550             </goals>
    551             <configuration>
    552               <includes>**/*TestIT</includes>
     584            <configuration>
     585              <includes combine.self="override">
     586                <include>**/*TestIT</include>
     587              </includes>
     588              <excludes combine.self="override"/>
    553589            </configuration>
    554590          </execution>
    … …  
    560596            </goals>
    561597            <configuration>
    562               <testSourceDirectory>${test.dir}/functional</testSourceDirectory>
     598              <testClassesDirectory>${project.build.directory}/functional-test-classes</testClassesDirectory>
     599              <additionalClasspathElements>
     600                <additionalClasspathElement>${project.build.testOutputDirectory}</additionalClasspathElement>
     601              </additionalClasspathElements>
     602              <systemPropertyVariables>
     603                <josm.home>${test.dir}/config/functional-josm.home</josm.home>
     604              </systemPropertyVariables>
     605            </configuration>
     606          </execution>
     607          <execution>
     608            <id>functional-it-tests</id>
     609            <phase>integration-test</phase>
     610            <goals>
     611              <goal>test</goal>
     612            </goals>
     613            <configuration>
     614              <testClassesDirectory>${project.build.directory}/functional-test-classes</testClassesDirectory>
     615              <additionalClasspathElements>
     616                <additionalClasspathElement>${project.build.testOutputDirectory}</additionalClasspathElement>
     617              </additionalClasspathElements>
     618              <systemPropertyVariables>
     619                <josm.home>${test.dir}/config/functional-josm.home</josm.home>
     620              </systemPropertyVariables>
     621              <includes combine.self="override">
     622                <include>**/*TestIT</include>
     623              </includes>
     624              <excludes combine.self="override"/>
    563625            </configuration>
    564626          </execution>
    … …  
    570632            </goals>
    571633            <configuration>
    572               <testSourceDirectory>${test.dir}/performance</testSourceDirectory>
     634              <skip>${skipPerformanceTests}</skip>
     635              <testClassesDirectory>${project.build.directory}/performance-test-classes</testClassesDirectory>
     636              <additionalClasspathElements>
     637                <additionalClasspathElement>${project.build.testOutputDirectory}</additionalClasspathElement>
     638              </additionalClasspathElements>
     639              <systemPropertyVariables>
     640                <josm.home>${test.dir}/config/performance-josm.home</josm.home>
     641              </systemPropertyVariables>
    573642            </configuration>
    574643          </execution>
Note: See TracChangeset for help on using the changeset viewer.