Not able to execute tests with @Test annotation when my test extends TestCase(Junit) in Eclipse

后端 未结 3 1609
无人及你
无人及你 2021-01-16 14:04

Not able to execute tests with @Test annotation when my test extends TestCase(Junit) in Eclipse

It works fine when I am not extending from TestCase(jUnit), but my ex

3条回答
  •  有刺的猬
    2021-01-16 14:43

    Check that you are not using JUnit3 runner.

    Open 'Run Configuration' for you test and on Test tab make sure you have JUnit 4 selected for your test runner.

    IMHO, if you are retrofitting your test suite for JUnit4, just drop support for JUnit3.

    BTW, if you switch to 'JUnit 4' runner it will still execute old JUnit3 classes ( you don't have to add @Test annotations to them ).

提交回复
热议问题