我正在使用纯Java项目的sbt版本0.13.2。
我build.sbt
的行如下:
libraryDependencies ++= Seq("com.novocode" % "junit-interface" % "0.10" % "test")
我的测试如下所示:
import org.junit.Test;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.Assert.*;
@RunWith(JUnit4.class)
public class ExampleTest{
@Test
public void firstTest(){
org.junit.Assert.assertEquals("2.5 + 7.5 = 10.0", 2.5 + 7.5, 10.0, .1);
}
}
当我sbt test
从命令行执行操作时,测试已成功编译,但测试未运行。它说
Compiling 1 Java source to [my path]/target/scala-2.10/test-classes...
...
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[success] Total time: 1 s, completed May 31, 2014 5:56:22 PM
知道如何执行测试吗?
当我删除@RunWith
注释时,我的测试运行正常。我不知道为什么这可以解决问题。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句