Without using @Test can't we run a test class with only @RunWith

Viewed 414

Recently I have upgraded the spring boot test version from 1x to 2x, I had a test class annotated with @RunWith and there are no test methods(@Test) inside the class.

Now am getting an initialization error, while building the application, if I have removed the @RunWith or using @Test along with @RunWith the build is successful.

I really wanted to know what is the cause of the issue, how it is able to build before the upgrade, and why it requires at least one @Test to build my application.

Currently using Junit4. Any help is much appreciated...

Fallowing is the error log while building:

Running info.domain.AbstractIntegrationTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.225 sec <<< FAILURE!
initializationError(info.domain.AbstractIntegrationTest)  Time elapsed: 0.003 sec  <<< ERROR!
org.junit.runners.model.InvalidTestClassError: Invalid test class 'info.domain.AbstractIntegrationTest':
  1. No runnable methods
        at org.junit.runners.ParentRunner.validate(ParentRunner.java:525)

Test class

@RunWith(SpringRunner.class)
@ContextConfiguration(classes = { InfoConfig.class, TestConfig.class})
public class AbstractIntegrationTest {

}
0 Answers
Related