ServerSideCat
ServerSideCat

Reputation: 2062

How to see test failed in mvn

I have one single simple test

public class SimpleCheck {
    @Test
    public void check(){
        assertTrue(1 < 0);
    }
}

I run mvn test and see following message.

[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ check-check ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.024 s
[INFO] Finished at: 2014-12-10T23:25:13+02:00
[INFO] Final Memory: 8M/245M
[INFO] ------------------------------------------------------------------------

As you noticed this test will fails, however i don't see any failures at least. I have clean pom.xml with just one junit dependency.

How to see failures?

EDIT:

I found the solution - i should simply name it with *Test prefix. My test was Check, and now it is CheckTest.

Upvotes: 0

Views: 425

Answers (1)

Jigar Joshi
Jigar Joshi

Reputation: 240918

looks like you don't have assertion enabled while running tests you need to enable them

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.16</version>
    <configuration>
        <enableAssertions>true</enableAssertions>
    </configuration>
  </plugin>

Upvotes: 1

Related Questions