2013-08-16 12 views
11

私はそれぞれ平均2つのテスト関数を持つ4つのテストクラスを持っています。最初のテストは以下の通りで、正しいものでなければなりません(Playのチュートリアルのものです)。Play Framework(2.1.3)はテストを実行しません

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("[email protected]", "Bob", "secret").save(); 

    User bob = User.find.where().eq("email", "[email protected]").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 

これはなぜですか?私に何ができる? 私は最近、プレイ2.1.2から2.1.3にアップデートしました。私はすべてのリファレンスを更新し、プロジェクトはテストを除いて正常に動作しています。 私もlooked at this questionですが、私はテストを変更していないので、それはうまく書かれているわけではありません。

+2

あなたはフォーマットがでキックとあなたの質問にビューのもう少しを持つことができるように、Javaのタグを追加する必要があります;) –

+0

ニースの先端を、私はそれについて知りませんでした;) – dialex

答えて

14

これはa known issue of Play 2.1.3です。一方、a workaroundがあります。 valのメイン機能で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 
    } 
) 
+0

私はトンを助けた..私はf/wを再生する初心者 – saurshaz

関連する問題