4

I have a maven project setup to run my JUnit tests. I am utilizing Sikuli to click on certain images on the screen. When executing my test using the "mvn test" command in a terminal or through Eclipse it will work.

I now have to integrate these tests in Jenkins which I assumed would be straight forward; however, this is not the case. After creating a job in Jenkins I executed the "mvn test" command to run my tests and maven does run the test but the test will always fail because Sikuli cannot find the image on the screen. The Sikuli error message is

\Jenkins\workspace\Smoke_Test_Suite\Console\src\main\java\resources\main-widget\calc.PNG: (229x325) in R[0,0 1024x768]@S(0)

Has anyone ran into this issue with Sikuli and Jenkins. If so, how can one resolve this problem?

  • Keep in mind that Sikuli will not work in "headless" mode. It needs a physical screen attached. – Eugene S Nov 08 '19 at 20:57
  • I am running Jenkins on the same PC / screen that Sikuli is being run on. If that is what you mean. –  Nov 08 '19 at 21:05
  • And do you still have the area that you are trying to automate on top of the other windows and applications so that Sikuli can "see" it? – Eugene S Nov 08 '19 at 21:23
  • Once I select "build now" in Jenkins I minimize everything on the screen except the image that I want to click on but no luck. If I perform this same exact method through either Eclipse or command prompt it works. –  Nov 08 '19 at 21:30
  • I am receiving this as an error: [error] ImagePath: find: not there: calc.PNG FindFailed: calc.PNG not loaded –  Nov 08 '19 at 22:18
  • Ok, it looks like there is an issue with finding the image file on the disk rather than the pattern on the screen. Please see my answer. – Eugene S Nov 09 '19 at 15:57

1 Answers1

1

It seems that the image file cannot be found rather than the pattern itself on the screen. It is likely to be some difference in the the environment variables configuration and when running through Jenkins/Maven, the paths are incorrect. To debug this issue to get a better understanding what is actually configured, try to add the following line to your code and run it using Jenkins again:

System.out.println(getBundlePath());

This will print out the currently configured path to where Sikuli looks for image files. I assume it looks for the files in the incorrect location. To set the path to the correct location. you can do:

ImagePath.setBundlePath(correctPath);
Eugene S
  • 6,709
  • 8
  • 57
  • 91
  • 1
    Thank you. Unfortunately, this did not resolve the issue. This post guided me to fix my problem: https://serverfault.com/a/285140/548005. The other step which I also needed to take was to change my JENKINS_HOME environmental variable to point to my original Jenkins setup. So, by running Jenkins as a standalone application via the Jenkins .war file will allow Sikuli to interact with the GUI components on screen. I wish I could give more details as to the "why" the service prevents GUI components from being seen. If I do at some point I will update this post. –  Nov 11 '19 at 01:34