如何设置Sikuli路径

时间:2016-05-12 22:45:58

标签: java automation sikuli

我正在使用SikuliX来测试我的游戏。这是我正在运行的代码:

public void testApplication() throws FindFailed {

    // pass if there are merely no warnings/exceptions
    /* Example of using Jelly Tools (additional test dependencies required) with gui(true):
        new ActionNoBlock("Help|About", null).performMenu();
        new NbDialogOperator("About").closeByButton();
     */


    try {
        plugin.start(gameData, world);
        screen.wait("/Resources/playerStart.png");
    } catch (FindFailed ex) {

        System.out.println("PlayerStart failed!");
    }

    Assert.assertEquals(1, world.size());
    try {
        screen.wait("playerMoveForward.png");
        screen.type("wwwwwwww");
    } catch (FindFailed ex) {
        System.out.println("Player movement failed!");
    }

    try {
        screen.wait("playerTurnRight.png");
        screen.type("dddddddd");
    } catch (FindFailed ex) {
        System.out.println("Player turn failed!");
    }

}

我在第一个screen.wait()上得到一个空指针,所以路径不正确,我不知道如何找到正确的指针。我试图使用的图像的完整路径是:

C:\Users\Jesper\Documents\NetBeansProjects\AsteroidTEST\AsteroidsTEST\application\src\test\java\Resources\playerStart.png

1 个答案:

答案 0 :(得分:0)

您可以使用ImagePath.setBundlePath静态方法定义您的Sikuli路径,如下所示:

ImagePath.setBundlePath("C:/temp/sikulipatterns/"); //insert your own path instead