当我的测试在Eclipse中扩展TestCase(Junit)时,无法使用@Test注释执行测试 [英] Not able to execute tests with @Test annotation when my test extends TestCase(Junit) in Eclipse
本文介绍了当我的测试在Eclipse中扩展TestCase(Junit)时,无法使用@Test注释执行测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我没有从TestCase(jUnit)扩展时, ,但是我现有的代码从TestCase扩展,所以我想保持原样。
解决方案
扩展 junit.framework
。 TestCase被认为是由JUnit4转轮进行JUnit3风格的测试。这是正确的。
要@Test注释,您需要不扩展 junit.framework
。 TestCase和@Test注释工作正常
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 existing code extends from TestCase hence I would like to keep that as it is.
解决方案
Tests that extend junit.framework
. TestCase are considered to be JUnit3-style tests by the JUnit4 runner. This is correct.
To @Test annotation you need NOT extend junit.framework
. TestCase and @Test annotation works fine
这篇关于当我的测试在Eclipse中扩展TestCase(Junit)时,无法使用@Test注释执行测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文