我正在尝试使用JUnit测试框架在ant
构建器中运行Scala类。
TESTFILE :
import org.junit.Test
import org.junit.Assert._
class MyTests{
def helperfunction1() = //implementation
def helperfunction2() = //implementation
@Test
def testExamples() = {
//testing stuff
}
}
Ant XML build.xml文件
. . . .
<target name="run-tests">
<junit>
<include name="**/*Tests.class" />
</junit>
</target>
. . . .
当我尝试运行run_test时出现此错误:
[junit] java.lang.Exception: Test class should have exactly one public constructor
. . . . (further stacktrace)
[junit] Method testExamples() should not be static
[junit] java.lang.Exception: Method testExamples() should not be static
. . . . (further stacktrace)
我不明白我可能做错了什么。你能帮忙吗?