2016-05-12 167 views
0

我正在使用SikuliX来测试我的游戏。下面是我运行代码:如何设置Sikuli路径

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 
+0

的[可能的复制什么是空指针异常,以及如何解决它?](http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it) – rmlan

+1

可能是,但那个链接对我根本没有帮助。 – Jesper

回答

0

您可以定义使用ImagePath.setBundlePath静态方法你这样的Sikuli路径:

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