Moshe Tsabari
Moshe Tsabari

Reputation: 372

JUnit inheritance using BaseTest

Hi I want to use base test that some test will extand . here is my base

@RunWith(MockitoJUnitRunner.class)
public class BaseOmsUnitTest {

  @BeforeClass
  public static void setUpBeforCalss() throws Throwable{
    JunitUtils.mockIlSession();
    OMSDomainsMocker helper = new OMSDomainsMocker();
    helper.mockOMSDomainConnection();

  }

  @Test
  public void dummyTest(){

  }
}

As you can see I want that every class that will inherit this base test will have the same init I also deliberately add the @RunWith annotation as the init need this runner. but when I run the tests with maven its without putting a dummyTest its gives me
No tests found in Base Haven't you forgot @Test annotation?

Can I overcome this without using this dummyTest

Upvotes: 1

Views: 1090

Answers (1)

bedrin
bedrin

Reputation: 4586

Just make your base class abstract

Upvotes: 6

Related Questions