Java 基于 Swing 的应用程序的最佳测试工具是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/79891/
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
What is the best testing tool for Swing-based applications?
提问by awied
While we try to set up as many unit tests as time allows for our applications, I always find the amount of UI-level tests lacking. There are many options out there, but I'm not sure what would be a good place to start.
虽然我们尝试为我们的应用程序设置尽可能多的单元测试,但我总是发现缺少 UI 级测试的数量。有很多选择,但我不确定什么是一个好的开始。
What is your preferred unit testing tool for testing Swing applications? Why do you like it?
用于测试 Swing 应用程序的首选单元测试工具是什么?你为什么喜欢它?
采纳答案by gizmo
On our side, we use to test SWING GUI with FEST. This is an adapter on the classical swing robot, but it ease dramatically its use.
在我们这边,我们使用FEST来测试 SWING GUI 。这是经典摆动机器人上的适配器,但它大大简化了其使用。
Combined with TestNG, We found it an easy way to simulate "human" actions trough the GUI.
结合 TestNG,我们发现这是一种通过 GUI 模拟“人类”动作的简单方法。
回答by zurk
try pounder : http://pounder.sourceforge.net/
回答by Roland Schneider
I had the chance to play around with QF-TEST once. It is commercial, but offers a lot of functionality. Maybe you have a look at it: http://www.qftest.de/en/index.html
我有机会玩过一次 QF-TEST。它是商业的,但提供了很多功能。也许你看看它:http: //www.qftest.de/en/index.html
回答by Roland Schneider
Consider Marathon (http://www.marathontesting.com/Home.html)--testsare written in Jython, so it's easy to write any sort of predicates based on object state.
考虑 Marathon ( http://www.marathontesting.com/Home.html)——测试是用 Jython 编写的,因此很容易编写基于对象状态的任何类型的谓词。
回答by Tom
I like Jemmy, the library written to test Netbeans.
我喜欢 Jemmy,它是为测试 Netbeans 而编写的库。
回答by Dema
You can try to use Cucumberand Swingerfor writing functional acceptance tests in plain english for Swing GUI applications. Swinger uses Netbeans' Jemmylibrary under the hood to drive the app.
您可以尝试使用Cucumber和Swinger为 Swing GUI 应用程序编写纯英语的功能验收测试。Swinger 在幕后使用 Netbeans 的Jemmy库来驱动应用程序。
Cucumber allows you to write tests like this:
Cucumber 允许您编写这样的测试:
Scenario: Dialog manipulation
Given the frame "SwingSet" is visible
And the frame "SwingSet" is the container
When I click the menu "File/About"
Then I should see the dialog "About Swing!"
Given the dialog "About Swing!" is the container
When I click the button "OK"
Then I should not see the dialog "About Swing!"
Take a look at this Swinger video demoto see it in action.
看看这个Swinger 视频演示,看看它的实际效果。
回答by bguiz
If your target application has custom components, I would definitely recommend Marathonto automate your tests.
如果您的目标应用程序有自定义组件,我肯定会推荐Marathon来自动化您的测试。
I was given the task of automating an application with several extremelycomplicated custom components, written in-house from the ground up. I went through a review process that lasted two months, in which I made the decision on which test tool to use, from a list of close to 30 test tools that were available, both commercial and FOSS.
我的任务是自动化一个应用程序,其中包含几个极其复杂的自定义组件,这些组件是从头开始在内部编写的。我经历了一个持续两个月的过程,在此过程中,我从近 30 种可用的测试工具列表中决定使用哪种测试工具,包括商业和 FOSS。
It was the onlytest tool that was able to successfully automate our particular custom components; where IBM's Rational Functional Tester, Microfocus' TestPartner, QF-Test, Abbot & FEST failed.
它是唯一能够成功自动化我们特定自定义组件的测试工具;IBM 的 Rational Functional Tester、Microfocus 的 TestPartner、QF-Test、Abbot 和 FEST 都失败了。
I have since been able to successfully integrate the tests with Cruise Control such that they run upon completing each build of the application.
从那以后,我已经能够成功地将测试与 Cruise Control 集成在一起,以便它们在完成应用程序的每个构建时运行。
A word of warning though:
1) it is rather rough around the edges in the way it handles JTables. I got around this by writing my own proxy class for them.
2) Does not support record/replay of drag-and-drop actions yet.
不过有一句警告:
1)它在处理 JTable 的方式上相当粗糙。我通过为他们编写自己的代理类来解决这个问题。
2) 尚不支持拖放操作的录制/回放。
回答by Serge Merzliakov
I can highly recommend QFTest. I have used it for my commercial product and it works very well with almost zero code (my app requires the use java client APIs for some things). It handles identification of swing components well, and is pretty tolerant of updates to your GUI - (resizing,repositioning and adding components does not break existing tests). I have done major updates to functionality and have my tests still work.
我强烈推荐 QFTest。我已经将它用于我的商业产品,它在几乎零代码的情况下运行良好(我的应用程序需要使用 Java 客户端 API 来处理某些事情)。它可以很好地处理摆动组件的识别,并且对 GUI 的更新非常宽容 - (调整大小、重新定位和添加组件不会破坏现有测试)。我已经对功能进行了重大更新,并且我的测试仍然有效。
Its expensive, but I think it will pay itself off in a couple of months.
它很贵,但我认为它会在几个月内收回成本。
Before QFTest I tried:
在 QFTest 之前,我尝试过:
1) Automatedqa - good tool, but windows centric and does not understand Swing. Similar to Quick test Pro.
1)Automatedqa - 好工具,但以 Windows 为中心,不了解 Swing。类似于 Quick test Pro。
2)UISpec4J - After devoting a solid 50 hour week to this, I had issues with fragility and the arcane java code it produced. Using it was just too arduous - trying to debug/update hundreds of lines of java performing a sequence of a dozen GUI operations just did not work for my brain. I ended up avoiding writing tests because it much more complicated than actually writing the app itself!
2)UISpec4J - 在为此投入了 50 小时的稳定时间后,我遇到了脆弱性和它产生的神秘 java 代码的问题。使用它实在是太费劲了——试图调试/更新数百行 Java 代码来执行一系列的十几个 GUI 操作,这对我的大脑不起作用。我最终避免编写测试,因为它比实际编写应用程序本身要复杂得多!
回答by Tim Ottinger
Not an answer, but a refining.
不是回答,而是提炼。
Record-and-playback is the wrong thing to want. Teams need the ability to write tests before the code has been written. Otherwise, the coders finish their work and wait around while the testers scramble to record tests (interrupted by fixes when they spot issues).
记录和回放是错误的事情。团队需要在编写代码之前编写测试的能力。否则,编码人员完成他们的工作并等待测试人员争先恐后地记录测试(当他们发现问题时会被修复程序打断)。
In a BDD/TDD/ATDD kind of setup, you really need some kind of tool that allows you to script tests for code that hasn't been written yet, specifying UI element names and the like.
在 BDD/TDD/ATDD 类型的设置中,您确实需要某种工具来为尚未编写的代码编写脚本测试,指定 UI 元素名称等。
Are there tools that work for non-waterfall testing?
是否有适用于非瀑布测试的工具?