2

I've got a simple unit test that is failing on purpose. The failed test shows up in the output, but the build succeeds with no failed unit tests. A normal unit test without SpringJUnit4ClassRunner fails as expected and the build is marked as fail. What's going on?

Spring: 4.2.6.RELEASE

Test class:

import config.TestAppConfig;
import config.TestDataConfig;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {TestAppConfig.class, TestDataConfig.class})
public class UserTest {
    @Test
    public void testNoDupes() {
        Assert.assertNotNull(null);
    }
}

Output:

[error] Test UserTest.testNoDupes failed: null, took 0.004 sec
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[success] Total time: 5 s, completed Jun 3, 2016 11:04:32 AM
Mike Emery
  • 807
  • 1
  • 11
  • 23
  • I was getting similar issue while running cucumber-jvm via junit runner. In my case after the cucumber tests, sbt runs the scala test runner, but there are no scala-tests and it ignores cucumber failures, and makes the build pass. – saad Nov 30 '16 at 07:30

0 Answers0