【发布时间】:2013-12-17 19:42:33
【问题描述】:
我编写了一个简单地扩展 TestCase 的单元测试,我有以下内容:
public class MetricParserTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
public void testFailure() {
fail("This needs to fail");
}
}
当我使用ant test 或adb shell am instrument 运行测试时,我得到以下结果:
... [exec] OK(1 次测试)...
我希望在命令行上看到失败。
【问题讨论】:
-
我也有同样的问题。可以看到一行一行运行的时候抛出了AssertionFailedError,但是eclipse、ant、logcat都报测试通过了?
-
我认为你应该问自己的问题@ChrisNoldus
-
为什么要复制它?我们很可能遇到完全相同的问题。
标签: android unit-testing ant junit