Hi,

the configuration in your pom file is wrong...

Several parts.. not using the most recent version of JUnit Jupiter
(current 5.7.0) furthermore not the right version of
maven-surefire-pugin as described in the JUnit Jupiter documentation ...

Also mixing assertions in JUnit 4 test vs .JUnit 5 Test...


In your JUnit 5 Tests only imports from:

org.junit.jupiter.api.* should be there...

                Assertions.fail(mess);
instead of: Assert.fail(mess);

I have attached the cleaned up pom file which you can take a look ...

Also you should check the names of your test methods ... ... the prefix
"test__" is not needed anymore since JUnit 4 ...

Kind regards
Karl Heinz Marbaise


On 24.11.20 18:15, Alain Désilets wrote:
I am trying to upgrade from JUnit4 to JUnit5 and am experiencing a
strange issuewhereby:

- JUnit4 tests are fine
- JUnit5 tests work when run through intelliJ, but are ignored when run
through the maven command line

I attach a small project (zip file) that illustrates the issue. Also
attached is the output (footest.txt) of running this command:

    mvn clean install > footest.txt


If you look in that file, you see a failure message for test__JUnit4Test
which proves that the test was run. But there are no failure message
for test__JUnit5Test which proves that this test was NOT run.

When I run the tests in intelliJ, I see failures for both tests which
proves that they were both run.

 From my reading, I see that several people have reported this issues
but none of the proposed fixes work for me. Any help would be appreciated.

BTW: Here is the info about my maven version

    *Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)*

    Maven home: /opt/apache-maven

    Java version: 1.8.0_102, vendor: Oracle Corporation, runtime:
    /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/jre

    Default locale: en_CA, platform encoding: UTF-8

    OS name: "mac os x", version: "10.14.6", arch: "x86_64", family: "mac"


Thx.

Alain Désilets


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Mit freundlichem Gruß
Karl-Heinz Marbaise
--
SoftwareEntwicklung Beratung Schulung    Tel.: +49 (0) 2405 / 415 893
Dipl.Ing.(FH) Karl-Heinz Marbaise        USt.IdNr: DE191347579
Hauptstrasse 177
52146 Würselen                           https://www.soebes.de
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";>
  <modelVersion>4.0.0</modelVersion>

  <groupId>ca.nrc.spikes</groupId>
  <artifactId>spike-junit</artifactId>
  <version>1.0.0-SNAPSHOT</version>

  <properties>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.source>1.8</maven.compiler.source>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <junit.version>4.12</junit.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.junit</groupId>
        <artifactId>junit-bom</artifactId>
        <version>5.7.0</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
    <!-- For old JUnit4 tests -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.0.0-M5</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to