问题描述
对于我的 Play 2.0 应用程序,我想从 Eclipse 执行(Selenium)JUnit 测试.测试用例如下所示:
For my Play 2.0 application, I want to execute a (Selenium) JUnit test from Eclipse. The test case looks like:
@Test
public void runInBrowser() {
running(testServer(47111, fakeApplication(...)), ChromeDriver.class,
new Callback<TestBrowser>() {
public void invoke(TestBrowser browser) {
browser.goTo("http://localhost:47111");
assertThat(...);
}
});
}
测试服务器启动但测试过程中没有任何静态资源(例如*.css、*.js、*.png)可用,即访问http://localhost:47111
导致这些资源的 404.
The test server starts but none of the static ressources (e.g., *.css, *.js, *.png) is available during the test, that is, accessing http://localhost:47111
causes 404 for these resources.
我的 routes
文件包含:
GET /assets/*file controllers.Assets.at(path="/public", file)
静态资源位于以下文件夹中:publicimages ( *.png )、publicjavascripts ( *.js )、publicstylesheets ( *.css ).
The static resources are located in the folders: publicimages ( *.png ), publicjavascripts ( *.js ), publicstylesheets ( *.css ).
在 Eclipse 测试环境之外找到所有静态资源(例如,使用play test"在播放控制台中执行测试).
Outside the Eclipse test environment all static resources are found (e.g., executing the tests in the play console with "play test").
有什么想法吗?
推荐答案
终于找到了解决方案:
替换
<classpathentry kind="lib" path="target/scala-2.10/classes_managed"/>
与
<classpathentry kind="lib" path="target/scala-2.10/classes"/>
在 Eclispe .classpath 文件中.
in the Eclispe .classpath file.
这篇关于在从 Eclipse 执行的 Play 2.0 应用程序的(Selenium)JUnit 测试中找不到静态资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论