C++ 的测试自动化工具/库/框架; GUI 桌面 Windows 应用程序
不幸的是,我有一个在 Windows 上运行的 GUI 桌面应用程序,并使用 Borland C++ 编译器进行编译。我知道这是一项非常古老的技术,但这就是生活。我工作的公司有很多免费的 QTP 许可证。但说实话,我不喜欢这个工具,我想用一些开源替代品来改变它。
我有使用 Selenium 和一些 java swing 小程序的自动化 Web 服务的经验。 我基于 Java/JUnit 创建了测试。我想知道是否可以在 Java 中创建一些测试来测试我的 C++ 应用程序 - 那就太好了。如果这是不可能的,如果我可以使用任何 C/C++ 库来创建我自己的测试框架。
那不应该是单元测试。我想创建一套功能测试。 我希望能够本地化按钮、表格、单元格等对象,执行单击、更改焦点等操作。
此外,我还可以访问源代码。但这是相当古老的意大利面条代码,我对 C++ 应用程序没有太多经验。
你有什么建议?
unfortunatelly I have a GUI desktop application running on Windows and compiled using Borland C++ compiler. I know it's a very old technology, but that's the life. The company I work for have lots of free licences for QTP. But to be honest I don't like this tool and I want to change it with some open source alternative.
I have an experiance with automation Web services using Selenium, and some java swing applets.
I created my tests based on Java/JUnit. I'm wondering if I can create some tests in Java to test my C++ application - that would be great. If that's not possible if I can use any C/C++ libraries to create my own test framework.
That shouldn't be unit tests. I want to create rather a suite of functional tests.
I want to be able to localize objects like buttons, tables, cells, etc., perform action like clicking, changing focus, etc.
In addition I have access to source. But this is rather an old spaghetti code and I don't have much experiance with C++ apps.
What do you suggest?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我们使用 Sikuli 并且对它非常满意。它在各种自动化 API 之外工作,因此可以很好地处理非标准 UI。
We use Sikuli and have been quite happy with it. It works outside of the various automation APIs so it handles non-standard UIs very well.
开源工具
White是一个基于.NET的UI自动化工具,可以自动化win32应用程序除其他类型外。只要应用程序中使用的控件使用 Windows 的标准 UIAutomation 挂钩公开其内容/行为,那么您应该能够使用它来执行您需要的操作。
UIAutomation verify 是另一个 CodePlex 项目,它使用相同的 API 来自动化符合 UIA 的 UI。
Visual Studio
最后,如果您有权访问它,那么 Visual Studio 2010 已在高级/终极版本中内置了脚本化 UI 测试功能 - 编码的 UI 测试。这支持具有记录/重放和脚本功能的.NET、本机和 Web 应用程序。
Open Source Tools
White is a .NET based UI automation tool that can automate win32 applications among others types. As long as the controls used in your app expose their content/behaviour using Windows' standard UIAutomation hooks then you should be able to use it to do what you need.
UIAutomation Verify is another CodePlex project that works with the same APIs to automate UIA compliant UIs.
Visual Studio
Finally if you have access to it then Visual Studio 2010 has scripted UI test functionality built in Premium/Ultimate editions - Coded UI Tests. This supports .NET, native and web applications with record/replay and scripting functionality.
罗伯特,如果您的公司已经拥有 QTP 许可证,我建议您使用它。它是完成这项工作的正确工具,如果您的公司已经拥有它,那么重新发明轮子就没有意义了。它有它的缺点 - 我主要反对的是有限的 IDE 和 VBScript 脚本语言 - 但它并不是偶然成为市场领先的工具。用于测试 Windows C++ GUI 应用程序的开源选项并不多。您应该考虑的主要商业选项是 HP QTP、IBM Rational Function Tester 和 VS2010 Coded UI Tests。
Robert, if your company already has licenses of QTP, I suggest you use that. It's the right tool for the job, and there's no sense reinventing the wheel if your company already owns it. It has its warts - my main objections are to the limited IDE and VBScript scripting language - but it did not become the market-leading tool by accident. There are not a lot of open-source options for testing a Windows C++ GUI app. The main commercial options you should consider are HP QTP, IBM Rational Functional Tester and VS2010 Coded UI Tests.
我同意 Robert 的观点,即 QTP 有时不是最好的工具,特别是当您希望它等待桌面应用程序完成其处理时。 QTP 命令不是同步的,这意味着 QTP 不会等到上一个命令完成执行才转到下一个调用。我们对此有很多问题。我们现在计划编写可以为 QTP 执行此操作的 ac# dll,并将其包含在我们的 QTP 程序中,以使 QTP 动态等待桌面应用程序完成其处理。目前,据我所知,QTP 不支持此类等待功能。
另外,回到对象识别问题,我们确实遇到了很多问题,并采取了另一种途径,即通过 QTP 中的击键使用助记符调用命令。正如 Simon 已经提到的,这可能是由于 GUI 元素未公开造成的。我们在这方面没有太多的控制权,所以我们没有对此进行进一步调查。
I agree with Robert that QTP is sometimes not the best tool, especially when you want it to wait for the desktop application to finish its processing. QTP commands are not synchronous, meaning that QTP does not wait until the previous command finishes execution before moving to the next call. We had a lot of issues with this. We are now planning to write a c# dll that can do this for QTP and include that in our QTP programs to make QTP to dynamically wait until the Desktop application finishes its processing. Currently, to my knowledge, no such wait functionality is supported by QTP.
Also, coming back to the object recognition issue, We did have a lot of issue with this and took the alternative route of invoking commands using Mnemonics through keystrokes in QTP. As Simon has already mentioned, this could be due to non-exposure of the GUI elements. We did not have much control in this regard and so we did not investigate further on this.