我有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,但它不可能是,因爲我沒有改變我的測試,所以他們寫得很好,這只是他們的執行不起作用。
您應該添加Java標記允許格式踢,並有更多一點的看法上你的問題;) –
尼斯小費,我不知道,完成;) – dialex