4
votes

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(...);
            }
    });
}

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.

My routes file contains:

GET     /assets/*file               controllers.Assets.at(path="/public", file)

The static resources are located in the folders: public\images ( *.png ), public\javascripts ( *.js ), public\stylesheets ( *.css ).

Outside the Eclipse test environment all static resources are found (e.g., executing the tests in the play console with "play test").

Any ideas?

2

2 Answers

2
votes

Finally, I found a solution:

Replace

<classpathentry kind="lib" path="target/scala-2.10/classes_managed"/>

with

<classpathentry kind="lib" path="target/scala-2.10/classes"/>

in the Eclispe .classpath file.