【发布时间】:2010-03-21 16:29:50
【问题描述】:
我正在使用 Junit 4。我的整个程序运行良好。我正在尝试编写一个测试用例。但是有一个错误...
这是非常基本的示例测试
public class di extends TestCase{
private static Records testRec;
public void testAbc() {
Assert.assertTrue(
"There should be some thing.",
di.testRec.getEmployee() > 0);
}
}
当我运行它时,它给了我错误
fName can not be null
如果我使用 super 并且这样做
public TestA() {
super("testAbc");
}
一切正常。在 JUnit 3.X 之前不是这样的 我做错了还是他们改变了它:( 如果我不清楚,对不起
有没有办法在没有 super 的情况下执行测试?或调用函数等?
【问题讨论】:
-
什么是TestAgnes?第一个代码 sn-p 中没有提到它。请清除您的问题。
标签: java unit-testing junit testcase