Play Framework (2.1.3) n’exécute aucun test

J’ai 4 classes de test avec une moyenne de deux fonctions de test chacune. Le premier test est ci-dessous et doit être correct (c’est du tutoriel de Play).

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

Les autres sont faits sur mesure et ont une configuration @Before , comme ceci:

 public class UserTest extends WithApplication { @Before public void setUp() { start(fakeApplication(inMemoryDatabase())); } // creation and resortingeval of user @Test public void createAndResortingeveUser() { new User("[email protected]", "Bob", "secret").save(); User bob = User.find.where().eq("email", "[email protected]").findUnique(); assertNotNull(bob); // successfully resortingeved assertEquals("Bob", bob.getName()); // correct user resortingeved } } 

Maintenant, lorsque je lance le play test il se termine beaucoup plus rapidement et n’exécute aucun 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 

Pourquoi est-ce? Que puis-je faire? J’ai récemment mis à jour les jeux 2.1.2 à 2.1.3. J’ai mis à jour toutes les références et le projet fonctionne bien, à l’exception des tests. J’ai aussi regardé cette question , mais il est impossible que, comme je n’ai pas modifié mes tests, ils sont bien écrits, c’est simplement leur exécution qui ne fonctionne pas.

C’est un problème connu de Play 2.1.3 . En attendant, il existe une solution de contournement . Ajoutez ce qui suit dans le fichier Build.scala de la fonction principale val:

 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 } )