FunctionalTest中的Fixtures.loadYaml并没有真正加载数据

问题描述 投票:0回答:1

我有以下功能测试,通过fixtures.loadYaml设置初始数据,但是当我查询测试用例中的记录时,我没有看到它们。有什么原因?

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

    @Test
    public void testIndex() {
        ....
    }
playframework functional-testing fixtures
1个回答
0
投票

基于最新版本http://www.playframework.org/documentation/1.2.3/test的文档,我改为调用loadModels,它起作用了。

@Before
public void setup() {
    Fixtures.deleteAllModels();
    Fixtures.loadModels("data.yml");
}
© www.soinside.com 2019 - 2024. All rights reserved.