Help needed: maven-surefire-plugin is skipping/not finding tests

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Help needed: maven-surefire-plugin is skipping/not finding tests

Jun Huang
Hi,

Recently in our hadoop project, we added maven-surefire-plugin for running unit tests by categories.

in hadoop root pom.xml:

      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
      </dependency>
:
:

<properties>
    <test.groups>org.apache.hadoop.classification.TestJUnitCategory$AllTests</test.groups>
    <junit.version>4.11</junit.version>
</properties>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.21.0</version>
          <configuration>
            <groups>${test.groups}</groups>
          </configuration>
        </plugin>


    <profile>
      <id>flakies</id>
      <properties>
        <test.groups>org.apache.hadoop.classification.TestJUnitCategory$FlakiesTest</test.groups>
      </properties>
    </profile>
    <profile>
      <id>stables</id>
      <properties>
        <test.groups>org.apache.hadoop.classification.TestJUnitCategory$StablesTest</test.groups>
      </properties>
    </profile>
    <profile>
      <id>integrations</id>
      <properties>
        <test.groups>org.apache.hadoop.classification.TestJUnitCategory$IntegrationsTest</test.groups>
      </properties>
    </profile>
    <profile>
      <id>none</id>
      <properties>
        <test.groups>!org.apache.hadoop.classification.TestJUnitCategory$AllTest</test.groups>
      </properties>
    </profile>
  </profiles>

Invoking tests by category works fine: mvn -P integrations. However, our old fashioned unit test execution got skipped by this maven-surefire-plugin:

13:16:35 [INFO] --- maven-antrun-plugin:1.7:run (create-log-dir) @ hadoop-hdfs ---
13:16:35 [INFO] Executing tasks
13:16:35 
13:16:35 main:
13:16:35    [delete] Deleting directory /tmp/tmp.o7flMN8505/src/ghuang/ghuang/hadoop-hdfs-project/hadoop-hdfs/target/test/data
13:16:35     [mkdir] Created dir: /tmp/tmp.o7flMN8505/src/ghuang/ghuang/hadoop-hdfs-project/hadoop-hdfs/target/test/data
13:16:35      [copy] Copying 16 files to /tmp/tmp.o7flMN8505/src/ghuang/ghuang/hadoop-hdfs-project/hadoop-hdfs/target/test-classes/webapps
13:16:35 [INFO] Executed tasks
13:16:35 [INFO] 
13:16:35 [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ hadoop-hdfs ---
13:16:35 [INFO] Nothing to compile - all classes are up to date
13:16:35 [INFO] 
13:16:35 [INFO] --- maven-surefire-plugin:2.20:test (default-test) @ hadoop-hdfs ---
13:16:35 [INFO] Surefire report directory: /tmp/tmp.o7flMN8505/src/ghuang/ghuang/hadoop-hdfs-project/hadoop-hdfs/target/surefire-reports
13:16:35 [INFO] parallel='none', perCoreThreadCount=true, threadCount=0, useUnlimitedThreads=false, threadCountSuites=0, threadCountClasses=0, threadCountMethods=0, parallelOptimized=true
13:16:35 [INFO] 
13:16:35 [INFO] -------------------------------------------------------
13:16:35 [INFO]  T E S T S
13:16:35 [INFO] -------------------------------------------------------
13:26:01 [INFO] 
13:26:01 [INFO] Results:
13:26:01 [INFO] 
13:26:01 [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
13:26:01 [INFO] 
13:26:01 [INFO] 
13:26:01 [INFO] --- maven-antrun-plugin:1.7:run (hdfs-test-bats-driver) @ hadoop-hdfs ---

I also verified that by removing surefire-plugin block in root pom.xml file will make these tests executing again as usual. So I have some questions here:

1. I saw the reported surefire-plugin version was 2.20 while I was defining 2.21 in my change. This is because it gets overwritten by the parent pom. So how do I make it use my customized version.

2. Is the version 2.21 the right version for this? I saw some post indicated version 2.21 might have some bug?

3. What is the fix for this issue?


Many thanks,
George

See attached pom.xml file.



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

pom.xml (36K) Download Attachment