Play Framework(2.1.3)不运行任何测试

我有4个测试类,每个测试类平均有两个测试函数。 第一个测试在下面,必须是正确的(来自Play的教程)。

public class ApplicationTest { @Test public void simpleCheck() { int a = 1 + 1; assertThat(a).isEqualTo(2); } } 

其他的是定制的,并有@Before设置,如下所示:

 public class UserTest extends WithApplication { @Before public void setUp() { start(fakeApplication(inMemoryDatabase())); } // creation and retrieval of user @Test public void createAndRetrieveUser() { new User("bob@gmail.com", "Bob", "secret").save(); User bob = User.find.where().eq("email", "bob@gmail.com").findUnique(); assertNotNull(bob); // successfully retrieved assertEquals("Bob", bob.getName()); // correct user retrieved } } 

现在,当我运行play test它完成得更快,并且不执行任何测试。

 PS C:\wamp\www\dcid> play test [info] Loading project definition from C:\wamp\www\dcid\project [info] Set current project to dcid (in build file:/C:/wamp/www/dcid/) [info] Compiling 4 Java sources to C:\wamp\www\dcid\target\scala-2.10\test-classes... [info] ApplicationTest [info] [info] [info] Total for test ApplicationTest [info] Finished in 0.014 seconds [info] 0 tests, 0 failures, 0 errors [info] models.UserTest [info] [info] [info] Total for test models.UserTest [info] Finished in 0.002 seconds [info] 0 tests, 0 failures, 0 errors [info] models.ProposalTest [info] [info] [info] Total for test models.ProposalTest [info] Finished in 0.002 seconds [info] 0 tests, 0 failures, 0 errors [info] Passed: : Total 0, Failed 0, Errors 0, Passed 0, Skipped 0 [success] Total time: 5 s, completed 16/Ago/2013 14:52:35 

为什么是这样? 我能做什么? 我最近从play 2.1.2更新到2.1.3。 我更新了所有引用,项目工作正常,除了测试。 我也看了这个问题 ,但不是这样,因为我没有改变我的测试,所以写得很好,只是他们的执行无效。

这是Play 2.1.3的一个已知问题 。 同时有一个解决方法 。 将以下内容添加到val main函数中的Build.scala文件中:

 val main = play.Project(appName, appVersion, appDependencies).settings( // Add your own project settings here testOptions in Test ~= { args => for { arg <- args val ta: Tests.Argument = arg.asInstanceOf[Tests.Argument] val newArg = if(ta.framework == Some(TestFrameworks.JUnit)) ta.copy(args = List.empty[String]) else ta } yield newArg } )