Windows GUI 自动化
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2952666/
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
Windows GUI Automation
提问by Kiran
I am planning to automate some of the functionality of the GUI developed in Microsoft Visual C#.
我计划自动化在 Microsoft Visual C# 中开发的 GUI 的一些功能。
I am new to Automation with GUI. Would be glad if you share your experience regarding GUI Automation and some of the tools available for the automation.
我是 GUI 自动化的新手。如果您分享有关 GUI 自动化和一些可用于自动化的工具的经验,我们会很高兴。
I plan to develop some programms / scripts in order to realise some of the functionality of the GUI
我计划开发一些程序/脚本以实现 GUI 的一些功能
回答by Tom Anderson
For automating Windows OS itself, the free AutoITuses a BASIC type syntax for automation. It is not open source but development is continuing on AutoHotkey, which is open source. Either of these two can be used for Windows GUI Automation without much effort.
为了自动化 Windows 操作系统本身,免费的AutoIT使用 BASIC 类型语法进行自动化。它不是开源的,但AutoHotkey 的开发仍在继续,它是开源的。这两者中的任何一个都可以毫不费力地用于 Windows GUI 自动化。
I think Microsoft would suggest you use Windows PowerShell, a task automation framework with support for WMI and COM for local and remote computers. Powershell is free. See this guide on performing Windows? UI automation tasks.
我认为 Microsoft 会建议您使用Windows PowerShell,这是一个支持本地和远程计算机的 WMI 和 COM 的任务自动化框架。Powershell 是免费的。请参阅有关执行 Windows 的指南?UI 自动化任务。
You tagged this question with Windows, Shell and Automation. None of these suggestions I made use C#, although AutoHotkey has community support for C# and Powershell is a .NET scripting/programming language.
你用 Windows、Shell 和自动化标记了这个问题。我提出的这些建议都没有使用 C#,尽管 AutoHotkey 有社区支持 C# 并且 Powershell 是一种 .NET 脚本/编程语言。
回答by katmoon
I've recently done a research on exactly the same topic. I haven't found an ideal tool. Here are the tools I looked at:
我最近对完全相同的主题进行了研究。我还没有找到理想的工具。以下是我查看的工具:
- QTP. This is the most famous, and so, you can find most answers to your questions in web. It supports function library, object repository, and various technologies. Developing scripts in QTP is slow because of different factors. Licenses cost big $$$. Uses VBscript (pah!)
- Coded UI Test. It is a part of Visual Studio 2010 Premium and Ultimate editions. Also costs $$$. Provides function library and object repository features. You'll need some understanding of programming. Uses C# for developing tests (VB as an alt). Microsoft strictly recommends using their recorder to generate tests. Although, if you have some experience in automation, you understand, that using a recorder only is impossible for developing good tests. So you'll need to get into details of the generated code. And it generates a LOT of code. Anyway, it's nice.
- Ruby+ AutoIt. Costs 0$. I like using Ruby+Rspec+Watir for automating web interface. Very customizable, fast in learning, developing, and executing. Although, couldn't make Ruby+Rspec work with .NET good enough. I tried to use AutoIt to access WindowsForms, but it was very hard to debug and search why something doesn't work.
- Ranorex. I didn't look at it much. It seems nice, works similar to QTP, costs $$$. I didn't have time to work with it more closely, and decided not to use it, because I didn't know what problem could arise during real automation (and I already had a QTP license).
- QTP。这是最著名的,因此,您可以在网络上找到大多数问题的答案。它支持函数库、对象存储库和各种技术。由于不同的因素,在 QTP 中开发脚本很慢。许可证成本很高。使用 VBscript (pah!)
- 编码的 UI 测试。它是 Visual Studio 2010 Premium 和 Ultimate 版的一部分。还要花费$$$。提供函数库和对象库功能。您需要对编程有所了解。使用 C# 开发测试(VB 作为替代)。Microsoft 严格建议使用他们的记录器来生成测试。但是,如果您有一些自动化方面的经验,您就会明白,仅使用记录器是不可能开发出好的测试的。因此,您需要了解生成的代码的详细信息。它会生成大量代码。无论如何,这很好。
- 红宝石+ AutoIt。费用 0 美元。我喜欢使用 Ruby+Rspec+Watir 来自动化 Web 界面。非常可定制,学习、开发和执行速度快。虽然,无法使 Ruby+Rspec 与 .NET 一起工作得足够好。我尝试使用 AutoIt 来访问 WindowsForms,但是很难调试和搜索为什么某些东西不起作用。
- 拉诺雷克斯。我没怎么看。看起来不错,工作方式类似于 QTP,成本 $$$。我没有时间更密切地使用它,决定不使用它,因为我不知道在真正的自动化过程中会出现什么问题(而且我已经有了 QTP 许可证)。