pau*_*doo 69 java testing swing automated-tests
有哪些选项可用于构建使用Java Swing编写的GUI的自动化测试?
我想测试一些使用NetBeans Swing GUI Builder编写的GUI,因此可以在不需要对被测代码进行特殊篡改的情况下工作.
小智 32
最近我遇到了FEST,看起来很有希望,但开发商在2012年宣布开发不会继续.
AssertJ是FEST的一个分支,对我来说效果很好.它是积极维护的(在编写本文时),支持Java 8,对Guava和Joda Time等一些流行的库有断言,并且有很好的文档记录.它也是免费和开放的.
Dem*_*ema 14
您可以尝试使用Cucumber和Swinger以简单的英语为Swing GUI应用程序编写功能验收测试.Swinger使用Netbeans的Jemmy库来驱动应用程序.
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!"
Run Code Online (Sandbox Code Playgroud)
看看这个Swinger视频演示,看看它的实际运行情况.
小智 8
我用java.awt.Robot
.不好,不容易,但每次都有效.
优点:
缺点:
现在,如果你有预算,我会选择LoadRunner.全班最优.
(披露:与拥有LR的公司的关系,但我在关系之前与LR合作)