我正在使用Play Framework 2.3和IntelliJ IDEA 14.我在我的应用程序中使用了Mailer插件。我写了一些功能测试,当我运行时,它可以很好地工作 test
将此行添加到SBT控制台中的命令 build.sbt:
javaOptions in Test += "-Dconfig.file=conf/application.test.conf"
而这一个到文件 CONF / application.test.conf:
smtp.mock=yes
不幸的是,当我直接从IntelliJ运行测试时,我收到此错误:
java.lang.RuntimeException: smtp.host needs to be set in application.conf in order to use this plugin (or set smtp.mock to true)
我尝试使用VM参数启动这些测试 -Dconfig.file=conf/application.test.conf
, 没有成功。
以下是我尝试执行的测试的两个示例:
@Test
public void testWithServer() {
running(testServer(3333), () -> {
assertThat(WS.url("http://localhost:3333").get().get(1000).getStatus()).isEqualTo(OK);
});
}
@Test
public void testWithBrowser() {
running(testServer(3333), HTMLUNIT, browser -> {
browser.goTo("http://localhost:3333");
assertThat(browser.$("title").getText()).isEqualTo("Welcome");
});
}
谁可以帮我这个事?
谢谢!