0

I have the following package structure:

src/main/java/com.mypackage/MyClass.java
src/test/java/com.mypackage/MyClassTest.java

And in the Test class, I had added a faulty test case, but when I build the module using mvn clean install, the test is not run. However, when I run the Test class using intellij's test execution, it is run and fails as expected.

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.mypackage/MyClassTest
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@3d8c7aca
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.449 sec

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

Pom file:

<?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">
    <parent>
        <artifactId>artifacts</artifactId>
        <groupId>com.fff.finance</groupId>
        <version>1.3.0-M2-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>com.fff.finance.response.type.handlers</artifactId>
    <name>fff - Response Type Handlers</name>
    <description>fff - Extended f Response Type Handlers</description>

    <dependencies>
        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
        </dependency>
    </dependencies>

</project>

Update:

The awkward scenario is that the tests are actually executed during build for certain team members. Does it have something to do with the maven version?

Krishnan Mahadevan
  • 14,121
  • 6
  • 34
  • 66
S.Dan
  • 1,826
  • 5
  • 28
  • 55
  • Please edit your question to include your "pom.xml" file. Also, check https://stackoverflow.com/questions/5534597/maven-surefire-not-finding-unit-tests and https://stackoverflow.com/questions/16708013/maven-doesnt-execute-any-unit-test. – Progman Feb 10 '19 at 11:36
  • Added pom content. – S.Dan Feb 11 '19 at 06:03
  • @Progman the tests are actually executed during build for certain team members. So I assume this maybe caused by maven (because maven version was different in our team members) – S.Dan Feb 11 '19 at 06:08
  • Run your maven commands with debug flag enabled and then compare the outputs from the different computers. – Progman Feb 11 '19 at 17:14

0 Answers0