我爲Play寫了一個簡單的測試課! 2.0:如何在PLAY中啓動Play Framework 2.0中的手動測試! V1?
public class TestLogin {
@Test
public void test() {
running(testServer(3333, fakeApplication(inMemoryDatabase())), HTMLUNIT, new Callback<TestBrowser>() {
@Override
public void invoke(TestBrowser browser) {
browser.goTo("http://localhost:3333");
assertThat(browser.$("section h1").first().getText()).isEqualTo("Login");
}
});
}
}
在玩V1,你可以執行以下命令:
play test
你能轉到http://localhost:9000/@tests
。但是現在在Play 2.0中這不起作用,它沒有記錄?我只是想開始我的Selenium測試,手動(每個測試用例/方法)都是自動化的(一堆測試用例)。
這怎麼能在Play2.0中實現?
BTW:捉迷藏命令播放測試輸出在我的終端如下:
[warn] 1 warning
[info] No tests to run for test:test
這幫了我;-)看起來像緩存是邪惡的(但它有助於更快地執行) – 2012-11-06 22:00:13