Play! Framework loading yaml from test sub package
I have a yaml file loaded by BasicTest.java in the t开发者_如何学运维est package, this creates the db data as expected in the h2 in memory db. When I move the BasicTest.java into a sub package, e.g. test.unit, it does not work. The yaml file is found, but the data is not created. What needs to change to fix this?
My test setup is shown below.
@Before
public void setUp() {
Fixtures.deleteAllModels();
Fixtures.loadModels("data.yml");
}
Try to add path to your "yml" to play framework internal PATH before you try to load it. Example(path to file is relative to application path):
VirtualFile appRoot = VirtualFile.open(Play.applicationPath);
Play.javaPath.add(0, appRoot.child("test/sub/packages/data.yml"));
精彩评论