简体   繁体   中英

How to set Sikuli path

I'm using SikuliX to test my game. Here's the code I'm running:

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!");
    }

}

I'm getting a null pointer on first screen.wait() , so the path is not right, and I have no idea how to get the right one. The full path of the image I'm trying to use is:

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM