java 有没有人使用 SIKULI 来测试他们基于 GUI 的应用程序?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2125839/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 19:34:46  来源:igfitidea点击:

Has anybody used SIKULI for testing their GUI-based apps?

javauser-interfacetestingsikuli

提问by Michael Balint

SIKULIseems to have an enormous amount of potential. Has anybody tried to use this as a tool for testing? Or would it be better suited for automating actions for users?

SIKULI似乎拥有巨大的潜力。有没有人尝试将其用作测试工具?或者它是否更适合为用户自动化操作?

采纳答案by Pascal Thivent

Quoting Unit Testing for GUI(in the project Documentation):

引用GUI 的单元测试(在项目文档中):

Sikuli is designed to support unit testing for GUI by integrating with junit. The unit testing panel can be opened by clicking on View/Unit Test or by shortcut Cmd-U on Mac (or Ctrl-U on Windows/Linux).

Sikuli 旨在通过与 junit 集成来支持 GUI 的单元测试。可以通过单击查看/单元测试或 Mac 上的快捷方式 Cmd-U(或 Windows/Linux 上的 Ctrl-U)打开单元测试面板。

So, while my understanding is that SIKULI is initially aimed at GUI automation, it can definitely be used for GUI testing (which is closely related if you consider that GUI testing = GUI automation + verification framework). Have a look at Unit testing for GUI (JEdit)for a full example (and see the assertXXXon images).

所以,虽然我的理解是 SIKULI 最初是针对 GUI 自动化的,但它绝对可以用于 GUI 测试(如果你认为 GUI 测试 = GUI 自动化 + 验证框架,这密切相关)。查看GUI 单元测试 (JEdit)以获取完整示例(并查看assertXXX图像)。

And indeed, I see a big potential in SIKULI for testing as it seems to make writing tests very easy, even without a single line of the real application written (just using some initial mockups for example). SIKULI could become a great companion for various flavor of testing (BDD, acceptance testing, etc).

事实上,我看到了 SIKULI 在测试方面的巨大潜力,因为它似乎使编写测试变得非常容易,即使没有编写一行真实的应用程序(例如只使用一些初始模型)。SIKULI 可以成为各种风格测试(BDD、验收测试等)的绝佳伴侣。

It' really an amazing piece of software, very impressive.

这真的是一个了不起的软件,非常令人印象深刻。

回答by Jordan Dea-Mattson

I am using Sikuli extensively for UI test automation. I am "late" to the Sikuli party, having discovered it in January 2011. I am actually glad I discovered it late, because while it was promising earlier, I don't think until Sikuli x1.0-rc1 (which happened in December) was released that it was ready for primetime.

我广泛使用 Sikuli 进行 UI 测试自动化。我“迟到”参加 Sikuli 派对,是在 2011 年 1 月发现的。我真的很高兴我发现它晚了,因为虽然它早些时候很有希望,但我认为直到 Sikuli x1.0-rc1(发生在 12 月) ) 宣布它已准备好迎接黄金时段。

Previously, I have used TestQuest and EggPlant for UI test automation. In my opinion, Sikuli beats both of them hands down. I truly believe it has the potential to dramatically change how folks perform UI test automation for the better and will be evangelizing it to folks around me.

以前,我使用 TestQuest 和 EggPlant 进行 UI 测试自动化。在我看来,Sikuli 击败了他们两个。我真的相信它有可能极大地改变人们执行 UI 测试自动化的方式,并将其传播给我周围的人。

Using Sikuli correctly is means that you are notfollowing a "record and playback" model. Rather, you have to approach developing test automation with Sikuli - as you need to with all tools - as a software development task.

正确使用 Sikuli 意味着您没有遵循“记录和回放”模型。相反,您必须使用 Sikuli 来开发测试自动化 - 正如您需要使用所有工具一样 - 作为一项软件开发任务。

We are currently in the process of porting a UI automation DSL (Domain Specific Language) we built for EggPlant to Sikuli. One of the key features we will be leveraging in our DSL is Sikuli's text recognition capabilities. This will allow us to run the same script across various localized versions of our product.

我们目前正在将我们为 EggPlant 构建的 UI 自动化 DSL(领域特定语言)移植到 Sikuli。我们将在 DSL 中利用的关键功能之一是 Sikuli 的文本识别功能。这将允许我们在我们产品的各种本地化版本中运行相同的脚本。

Because Sikuli builds on OpenCV (for image recognition)and tesseract-ocr (for text recognition), it has an incredibly amount of power and flexibility.

因为 Sikuli 建立在OpenCV(用于图像识别)tesseract-ocr(用于文本识别)之上,所以它具有令人难以置信的强大功能和灵活性。

回答by Surfdork

@jordan, Absolutley spot on 'Using Sikuli correctly is means that you are not following a "record and playback" model. Rather, you have to approach developing test automation with Sikuli - as you need to with all tools - as a software development task.

@jordan,“正确使用 Sikuli”的 Absolutley 点意味着您没有遵循“记录和回放”模型。相反,您必须使用 Sikuli 来开发测试自动化 - 正如您需要使用所有工具一样 - 作为一项软件开发任务。

I created an end to end test automation solution for testing a videoconferencing application made by the worlds largest PC manufacturer. They did not understand that it was a full dev project, not a point and click operation that any monkey could execute. Trying to explain the challenges of coding with a dynamically typed language was impossible.

我创建了一个端到端测试自动化解决方案,用于测试由世界上最大的 PC 制造商制造的视频会议应用程序。他们不明白这是一个完整的开发项目,而不是任何猴子都可以执行的点击操作。试图解释使用动态类型语言编码的挑战是不可能的。

From my experience the biggest challenge is image managment. I used the file system and configparser for the first iteration of the test automation. Using configparser worked however it was difficult to implement. In the future I plan on using blobs. Sikuli does not support direct extraction of images from a DB (yet) although I do have a work around.

根据我的经验,最大的挑战是图像管理。我在测试自动化的第一次迭代中使用了文件系统和 configparser。使用 configparser 可以工作,但是很难实现。将来我计划使用 blob。Sikuli 不支持直接从数据库中提取图像(还),尽管我有解决办法。

Use of an IDE is critical since the Sikuli IDE fails to have and development tools. The 2 IDE's I've configured, NetBeans and Eclipse/PyDev have their own set of issues. The are great for coding however false errors, injection of whitespace and code loss make both less than ideal solutions. I code and test in NetBeans, Execute in SikuliIDE and save all in notepad as a backup.

使用 IDE 至关重要,因为 Sikuli IDE 没有开发工具。我配置的 2 个 IDE,NetBeans 和 Eclipse/PyDev 有它们自己的一组问题。它们非常适合编码,但错误错误、空白注入和代码丢失都不是理想的解决方案。我在 NetBeans 中编码和测试,在 SikuliIDE 中执行并将所有内容保存在记事本中作为备份。

Inspite of any difficulties encounteres i'm a big supporter of Sikuli. Sikuli has the potential to change test automation, making it accesable to the entire QA community without having to be an OO coder.

尽管遇到任何困难,我还是 Sikuli 的坚定支持者。Sikuli 有可能改变测试自动化,使整个 QA 社区都可以访问它,而无需成为 OO 编码员。

回答by ccpizza

Recorded a workflow with a Flex web app. Took a while to figure out a reliable strategy to create the screenshots, but once I did it, the script continued working even after I changed my desktop color scheme! The syntax gets a bit awkward though when you need to click a specific control in a collection of similar controls, i.e. checkboxes, input fields. Looks like the only way to do it is by using find()in combination with right(); left(); inside(). Seems like the smaller the screenshots are, the more reliably are they detected. Imo a good practice would be to include only significant objects on screenshots, and make them as atomic as possible but without compromising their uniqueness.

使用 Flex Web 应用程序记录工作流。花了一段时间想出一个可靠的策略来创建屏幕截图,但是一旦我做到了,即使我更改了桌面配色方案,脚本仍然可以继续工作!但是,当您需要单击一组类似控件(即复选框、输入字段)中的特定控件时,语法会变得有点笨拙。看起来唯一的方法是find()right(); left(); inside(). 似乎屏幕截图越小,检测到的可靠性就越高。Imo 一个好的做法是在屏幕截图中只包含重要的对象,并使它们尽可能原子化,但不影响它们的独特性。

回答by David

For less developer centric test automation for Sikuli, also check out RobotFramework.org. There's a tutorial on how to make a (custom) Sikuli test library for Robot Framework

对于 Sikuli 较少以开发人员为中心的测试自动化,还可以查看 RobotFramework.org。有一个关于如何为 Robot Framework 制作(自定义)Sikuli 测试库的教程

http://blog.mykhailo.com/2011/02/how-to-sikuli-and-robot-framework.html

http://blog.mykhailo.com/2011/02/how-to-sikuli-and-robot-framework.html

and I created a simple generic version as well

我也创建了一个简单的通用版本

http://code.google.com/p/simplesikuli

http://code.google.com/p/simplesikuli

And if there was ever limitations for Sikuli in terms of window handling, GUI controls, mouse and keyboard interaction, you can always complement it with another great free test tool: AutoIt. AutoIt by itself also has limitations, when you combine it with Sikuli, they make up for each tools shortcomings, to replace commercial grade GUI test tools.

如果 Sikuli 在窗口处理、GUI 控制、鼠标和键盘交互方面有任何限制,您可以使用另一个出色的免费测试工具 AutoIt 来补充它。AutoIt本身也有局限性,当你与Sikuli结合时,它们弥补了每个工具的缺点,替代商业级GUI测试工具。

回答by Santosh

I have used sikuli for GUI testing, also i was able to integrate it with HUDSON.

我已经使用 sikuli 进行 GUI 测试,我也能够将它与 HUDSON 集成。

回答by smysnk

I have just published my own framework for GUI application testing using Skikuli + RobotFramework.

我刚刚使用 Skikuli + RobotFramework 发布了我自己的 GUI 应用程序测试框架。

SikuliFramework provides an object-oriented abstraction on top of Sikuli to assist with interacting GUI elements, such as sets of buttons, checkboxes, radio buttons, windows and dialogue hierarchies for GUI automation and testing. It also has tight integration with RobotFramework.

SikuliFramework 在 Sikuli 之上提供了一个面向对象的抽象,以协助交互 GUI 元素,例如用于 GUI 自动化和测试的按钮、复选框、单选按钮、窗口和对话层次结构。它还与 RobotFramework 紧密集成。

https://github.com/smysnk/sikuli-framework

https://github.com/smysnk/sikuli-framework

回答by smwikipedia

Sikuli is based on static image matching. So it is only suitable for situations where the GUI is sufficiently stable. For dynamic GUI such as animation or GUI which includes some kind of randomness, it is not so applicable.

Sikuli 基于静态图像匹配。所以它只适用于 GUI 足够稳定的情况。对于动态图形用户界面,如动画或包含某种随机性的图形用户界面,则不太适用。

And Sikuli only covers the visual part of the tested. It has no idea if the internal state is indeed as expected.

而Sikuli只涵盖了被测者的视觉部分。它不知道内部状态是否确实如预期的那样。

回答by ashish

I am a fan of Sikuli and I believe that it is complementary to other tests and can save much of the manual testing efforts.

我是 Sikuli 的粉丝,我相信它是对其他测试的补充,可以节省大量的手动测试工作。

However, it takes time to get it right. I gave it a second shot in the span of two years and the second time I was able to achieve good results as I was more familiar with the environment.

然而,需要时间来做对。我在两年的时间里给了它第二次机会,第二次我能够取得好成绩,因为我对环境更加熟悉了。

It comes with an intuitive IDE and python makes it easy to extend a few things. It's very easy to change click positions, set tolerance and record things. Once you get hold of how to record and check documentation, it becomes easy to use minimum images and improve accuracy. It catches changes in the GUI and results quite easily. It is also easy to wait for a certain event. Error checking is easy.

它带有一个直观的 IDE,python 可以轻松扩展一些东西。更改点击位置、设置容差和记录内容非常容易。一旦掌握了如何记录和检查文档,就可以轻松使用最少的图像并提高准确性。它捕获 GUI 中的更改并很容易产生结果。等待某个事件也很容易。错误检查很容易。

The biggest issue with it is that the recorded tests often fail if you just run it on another machine than the one it was recorded on. It might have to do with the image comparison based pattern matching. One can improve the match pattern probability by giving tolerance values. But it gets annoying at times to keep on changing the tolerance. My recommendation is to use a different set of images on different platforms and preferably run it on a single machine or VM.

它的最大问题是,如果您只是在另一台机器上运行它而不是记录测试,那么记录的测试通常会失败。它可能与基于图像比较的模式匹配有关。可以通过给出容差值来提高匹配模式的概率。但有时会很烦人,不断改变容差。我的建议是在不同平台上使用不同的图像集,最好在单个机器或 VM 上运行它。

Once you have a common set of workflows, you can make a library of those common functions such as (open-close-save project, change settings)and use across different scripts. It becomes very easy as the library gets comprehensive. It also means that you will have to change the script only at a single location and it will reflect in all the scripts.

一旦您有了一组通用的工作流程,您就可以制作一个包含这些通用功能的库,例如(打开-关闭-保存项目、更改设置)并在不同的脚本中使用。随着图书馆变得全面,这变得非常容易。这也意味着您只需在一个位置更改脚本,它将反映在所有脚本中。

I also created a simple framework (image attached) to run the tests and record results using C# .Net. One can make use of anything to create a simple test run application. It just needs to run the test on command line and check the results. enter image description here

我还创建了一个简单的框架(附图片)来运行测试并使用 C# .Net 记录结果。可以利用任何东西来创建一个简单的测试运行应用程序。它只需要在命令行上运行测试并检查结果。 在此处输入图片说明

I was working in a small team in which we had limited testing resources. With Sikuli I actually saved efforts of existing QA team and also helped myself catch the bugs before pushing it to main.

我在一个小团队中工作,我们的测试资源有限。使用 Sikuli,我实际上节省了现有 QA 团队的工作,还帮助自己在将其推送到主要之前捕获了错误。

I recommended Sikuli to members of other teams in my company and they use it to generate the dataset for the ML models. They did it by automating their Engg application with parameters.

我向公司其他团队的成员推荐了 Sikuli,他们用它来生成 ML 模型的数据集。他们通过使用参数自动化他们的 Engg 应用程序来做到这一点。

Sikuli takes time to sink in initially. But when done right, it could save lots of efforts.

Sikuli 最初需要时间来适应。但是如果做得对,它可以节省很多精力。