简体   繁体   English

Sikuli 通过 Jenkins 在屏幕上找不到图像

[英]Sikuli cannot find image on screen through Jenkins

I have a maven project setup to run my JUnit tests.我有一个 maven 项目设置来运行我的 JUnit 测试。 I am utilizing Sikuli to click on certain images on the screen.我正在使用 Sikuli 单击屏幕上的某些图像。 When executing my test using the "mvn test" command in a terminal or through Eclipse it will work.在终端中使用“mvn test”命令或通过 Eclipse 执行我的测试时,它将起作用。

I now have to integrate these tests in Jenkins which I assumed would be straight forward;我现在必须将这些测试集成到 Jenkins 中,我认为这很简单; 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.在 Jenkins 创建作业后,我执行了“mvn test”命令来运行我的测试,maven 确实运行了测试,但测试总是会失败,因为 Sikuli 在屏幕上找不到图像。 The Sikuli error message is Sikuli 错误消息是

\Jenkins\workspace\Smoke_Test_Suite\Console\src\main\java\resources\main-widget\calc.PNG: (229x325) in R[0,0 1024x768]@S(0) \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.有没有人遇到过 Sikuli 和 Jenkins 的这个问题。 If so, how can one resolve this problem?如果是这样,如何解决这个问题?

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.环境变量配置可能存在一些差异,并且在通过 Jenkins/Maven 运行时,路径不正确。 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:要调试此问题以更好地了解实际配置的内容,请尝试将以下行添加到您的代码中并再次使用 Jenkins 运行它:

System.out.println(getBundlePath());

This will print out the currently configured path to where Sikuli looks for image files.这将打印出当前配置的 Sikuli 查找图像文件的路径。 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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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