2016-05-12 219 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