我有一个看起来像这样的类:
---imports---
class ErroringClass {
/* methods*/
main{}
}
update
public class TestErroringClass {
static ArrayList<Integer> arrayTestTimes;
static ErroringClass main = new ErroringClass ();
@Test
public test{}
.
.
.
}
testcase:initializationerror花费了0.002秒 引起错误类错误的类不是公开的。java.lang.exception:类errortestclass不公开。 在java.lang.reflect.constructor.newinstance(constructor.java:423)
testcase:initializationerror花了0秒 引起错误测试类应该恰好有一个公共构造师java.lang.exception:测试类应完全有一个公共构造函数 在java.lang.reflect.constructor.newinstance(constructor.java:423)
<!-- Testsuite -->
<target name="test" depends="compile" >
<junit fork="yes"
description="Unit Tests"
showoutput="true"
printsummary="true"
outputtoformatters="true" filtertrace="on">
<classpath>
<path refid="classpath.test"/>
<pathelement location="${main.build.dir}"/>
<pathelement location="${test.build.dir}"/>
</classpath>
<test name="ErrorTestClass" outfile="./output" >
<!-- <formatter type="brief" usefile="true" /> -->
<formatter type="plain" usefile="true" />
</test>
</junit>
</target>
试图从ANT中运行我的测试,而不是让它们查看一个文件中的所有文件,以使源符合设计规则。我想念什么?
更新
Testsuite: ErrorTestClass
Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.104 sec
------------- Standard Output ---------------
[]
------------- ---------------- ---------------
Testcase: Test1 took 0.001 sec
Testcase: Test2 took 0 sec
Testcase: Test3 took 0 sec
Testcase: Test4 took 0 sec
Testcase: Test5 took 0 sec
Testcase: stringTestNull took 0.001 sec
Testcase: stringTestTrue took 0 sec
Testcase: assertNullTest took 0 sec
它,因为ErrorTestClass
具有软件包级别访问(默认可见性修改器)。将其更改为public class ErrorTestClass
。