Search code examples
playframeworkfunctional-testingfixtures

Fixtures.loadYaml in FunctionalTest didn't really load the data


I have the following functional test that setup the initial data via fixtures.loadYaml, but when I query the records in testcase, I don't see them. Any reasons?

public class UsersTest extends FunctionalTest {
    @Before
    public void setup() {
        Fixtures.loadYaml("data.yml");
    }

    @Test
    public void testIndex() {
        ....
    }

Solution

  • Based on the documentation on latest release http://www.playframework.org/documentation/1.2.3/test, I instead called loadModels, and it worked.

    @Before
    public void setup() {
        Fixtures.deleteAllModels();
        Fixtures.loadModels("data.yml");
    }