[Java Web学习]junit.framework.AssertionFailedError: No tests found in {Class}

时间:2023-03-09 05:26:11
[Java Web学习]junit.framework.AssertionFailedError: No tests found in {Class}

No tests found in com.XXXXX.XXX.inboundPrepService.bizLogic.prepDeterminationEngine.workers.DeterminePrepOwnerWorkerTest

junit.framework.AssertionFailedError: No tests found in
com.XXXXX.XXX.inboundPrepService.bizLogic.prepDeterminationEngine.workers.DeterminePrepOwnerWorkerTest

这个问题是因为测试类继承了TestCase,而使用了JUnit3的feature导致注解@Test不生效。

解决方案:在test方法名中添加前缀“test”,使用JUnit3的feature;或者不再继承JUnit3的父类。