我在 Play 中写了一个验收测试!2 框架,我的测试是:
@Test
public void goToIndexPageAT() {
running(testServer(3333, fakeApplication(inMemoryDatabase())), HTMLUNIT, new Callback<TestBrowser>() {
public void invoke(TestBrowser browser) {
browser.goTo("http://localhost:3333/");
assertThat(browser.url()).isEqualTo("http://localhost:3333/activities");
assertThat(browser.$("#title").getTexts().get(0)).isEqualTo("FitTime");
}
});
}
但是当我尝试使用命令 play test 运行这个测试时,我得到了一个错误:
Test acceptenceTest.ApplicationTest.goToIndexPageAT failed: Server is not started!
[error] at scala.sys.package$.error(package.scala:27)
[error] at play.api.test.TestServer.stop(Selenium.scala:116)
[error] at play.test.Helpers.stop(Helpers.java:308)
[error] at play.test.Helpers.running(Helpers.java:338)
[error] at acceptenceTest.ApplicationTest.goToIndexPageAT(ApplicationTest.java:17)
我做错了什么?
谢谢