简体   繁体   English

NetBeans平台应用程序:如何通过GUI创建用于首次自动端对端测试的测试环境?

[英]NetBeans Platform Application: How to create test environment for first automated end-to-end test through GUI?

How to write first end-to-end automated test for NetBeans Platform Application on Java (not just capture & replay) which suppose run the application and test if click on the Main Menu -> File -> Exit menu item will close it? 如何在Java上编写NetBeans平台应用程序的首个端到端自动化测试(而不仅仅是捕获和重播),该测试假定运行该应用程序并测试是否单击“主菜单”->“文件”->“退出”菜单项将其关闭?

Given: installed jdk1.6.0_17 and apache-maven-2.2.1 鉴于:已安装jdk1.6.0_17和apache-maven-2.2.1

Then: 然后:

mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo.archetypes -DarchetypeArtifactId=netbeans-platform-app-archetype -DarchetypeVersion=1.1 -DgroupId=stackoverflow.com -DartifactId=netbeans-app -Dversion=1.0-SNAPSHOT

Then: 然后:

mvn install
cd netbeans-app\application\target\foo\bin\
foo.exe 

And see that default GUI application is successfully running. 并看到默认的GUI应用程序已成功运行。

Which open-source GUI testing framework would you recommend for completing this task? 您将建议使用哪种开源GUI测试框架来完成此任务? Abbot/Costello, Jelly/Jemmy, UISpec4J, Marathon, FEST-Swing or WindowLicker? 住持/科斯特洛,果冻/杰米,UISpec4J,马拉松,FEST-Swing或WindowLicker?

I would say: 我会说:

Jemmy is probably out because it works best as an Eclipse plug in. (not sure about Jelly) Jemmy可能已退出市场,因为它最适合作为Eclipse插件使用。(不确定Jelly)

If you have custom components then Abbot/Costello is out, I found that it reacts unpredictably to those. 如果您有自定义组件,则Abbot / Costello不在了,我发现它会对那些组件做出不可预测的反应。 With custom components, it works like a charm though. 使用自定义组件,它的工作原理就像是一种魅力。

If running the tests from within your Netbeans IDE is very important to you, then Marathon is out as well, because you will need to the tests from the command line (or its standalone application of course). 如果从Netbeans IDE内运行测试对您来说非常重要,那么Marathon也不是一件容易的事,因为您将需要从命令行(当然是其独立应用程序)进行测试。 It has, IMO, the best support for custom components though. IMO对定制组件提供了最佳支持。

That leaves FEST really. 真正留下了FEST。 FEST integrates really well into running from Netbeans, because it can be run the same way as JUnit, with its test results getting displayed right in Netbean's IDE's "Test Results" panel. FEST可以很好地集成到Netbeans中,因为它可以与JUnit相同的方式运行,其测试结果可以正确显示在Netbean的IDE的“ Test Results”面板中。 And it comes with a really neat and simple plugin that makes it a no-brainer to set up the FEST tests: Geertjan's NetBeans plug-in for FEST-Swing . 它带有一个非常整洁而简单的插件,可以轻松设置FEST测试:Geertjan的FEST-Swing NetBeans插件 The main drawback of FEST is that it's replay only, no record, and test cases have to be written manually. FEST的主要缺点是仅重播,没有记录,并且必须手动编写测试用例。

I personally had to make a similar decision on choosing test tool for an automated testing framework several months ago - I went with Marathon, because custom component testing in my target application was of utmost importance. 几个月前,我个人不得不为自动测试框架选择测试工具时做出类似的决定-我参加了Marathon,因为目标应用程序中的自定义组件测试至关重要。 Other factors played out in the decision as well: Ability to integrate its tests into a continuous integration system, such as cruise control; 决策中还涉及其他因素:能够将其测试集成到持续集成系统中,例如巡航控制; and testers with limited programming ability were to write/ record the test scripts; 编程能力有限的测试人员将编写/记录测试脚本; was also important in our case. 在我们的案例中也很重要。

For your purposes, I would say for your specific question FEST seems like the most logical choice with the information known now. 就您的目的而言,对于您的特定问题,对于现在已知的信息,FEST似乎是最合逻辑的选择。

However, I suggest that you spend a day on each test tool, attempting to hook each one up and take notes about the pros and cons. 但是,我建议您花一天的时间在每个测试工具上,尝试将每个工具挂起来并记下优缺点。 AT the end of it, you might find that you have answered your own question better than I have because it is likely that you will discover more requirements than you yourself are aware of right now - I know I did! 最后,您可能会发现自己的问题比我的回答更好,因为您可能会发现比您自己现在意识到的更多的要求-我知道我做到了!

HTH HTH


Disclaimer: I have no experience with UISpec4J, Jelly and WindowLicker, so my answer may be inomplete. 免责声明:我没有UISpec4J,Jelly和WindowLicker的经验,所以我的回答可能不完整。


Edit: Just to add on, FEST can test the application when exiting. 编辑:补充一下,FEST可以在退出时测试应用程序。 It fixed that recently. 它最近修复了该问题。 Marathon cannot do the same - and that affects my testing for test cases which involve testing the closing of the application. Marathon无法做到这一点-这影响了我对涉及测试应用程序关闭的测试用例的测试。
As far as I am aware, Abbot/Costello also is affected by the same problem (but I have not kept up to date on this), and for the other test tools, I have not tried testing the exit of the application. 据我所知,Abbot / Costello也受到相同问题的影响(但我尚未对此进行更新),对于其他测试工具,我还没有尝试过测试应用程序的退出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM