<p>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. </p>

<p>What is your preferred unit testing tool for testing Swing applications? Why do you like it?</p>

[{'answer_id': 80184, 'author': 'zurk', 'author_id': 14907, 'author_profile': 'https://Stackoverflow.com/users/14907', 'pm_score': 1, 'selected': False, 'text': '<p>try pounder : <a href="http://pounder.sourceforge.net/" rel="nofollow noreferrer">http://pounder.sourceforge.net/</a></p>\n'}, {'answer_id': 80222, 'author': 'gizmo', 'author_id': 9396, 'author_profile': 'https://Stackoverflow.com/users/9396', 'pm_score': 5, 'selected': True, 'text': '<p>On our side, we use to test SWING GUI with <a href="http://code.google.com/p/fest/" rel="noreferrer">FEST</a>. This is an adapter on the classical swing robot, but it ease dramatically its use. </p>\n\n<p>Combined with TestNG, We found it an easy way to simulate "human" actions trough the GUI.</p>\n'}, {'answer_id': 87000, 'author': 'Roland Schneider', 'author_id': 16515, 'author_profile': 'https://Stackoverflow.com/users/16515', 'pm_score': 2, 'selected': False, 'text': '<p>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: <a href="http://www.qftest.de/en/index.html" rel="nofollow noreferrer">http://www.qftest.de/en/index.html</a></p>\n'}, {'answer_id': 122284, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': '<p>Consider Marathon (<a href="http://www.marathontesting.com/Home.html)--tests" rel="nofollow noreferrer">http://www.marathontesting.com/Home.html)--tests</a> are written in Jython, so it\'s easy to write any sort of predicates based on object state.</p>\n'}, {'answer_id': 142382, 'author': 'Tom', 'author_id': 22850, 'author_profile': 'https://Stackoverflow.com/users/22850', 'pm_score': 1, 'selected': False, 'text': '<p>I like Jemmy, the library written to test Netbeans.</p>\n'}, {'answer_id': 1001008, 'author': 'Dema', 'author_id': 407003, 'author_profile': 'https://Stackoverflow.com/users/407003', 'pm_score': 2, 'selected': False, 'text': '<p>You can try to use <a href="http://cukes.info" rel="nofollow noreferrer">Cucumber</a> and <a href="http://github.com/demetriusnunes/swinger" rel="nofollow noreferrer">Swinger</a> for writing functional acceptance tests in plain english for Swing GUI applications. Swinger uses Netbeans\' <a href="http://jemmy.dev.java.net" rel="nofollow noreferrer">Jemmy</a> library under the hood to drive the app.</p>\n\n<p>Cucumber allows you to write tests like this:</p>\n\n<pre><code> Scenario: Dialog manipulation\n    Given the frame "SwingSet" is visible\n      And the frame "SwingSet" is the container\n    When I click the menu "File/About"\n    Then I should see the dialog "About Swing!"\n    Given the dialog "About Swing!" is the container\n    When I click the button "OK"\n    Then I should not see the dialog "About Swing!"\n</code></pre>\n\n<p>Take a look at this <a href="http://blog.demetriusnunes.com/past/2009/6/9/who_said_you_cant_test_swing_apps/" rel="nofollow noreferrer">Swinger video demo</a> to see it in action.</p>\n'}, {'answer_id': 1671337, 'author': 'bguiz', 'author_id': 194982, 'author_profile': 'https://Stackoverflow.com/users/194982', 'pm_score': 3, 'selected': False, 'text': '<p>If your target application has <strong>custom components</strong>, I would definitely recommend <a href="http://www.marathontesting.com/" rel="noreferrer">Marathon</a> to automate your tests.</p>\n\n<p>I was given the task of automating an application with several <em>extremely</em> complicated 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.</p>\n\n<p>It was the <em>only</em> test tool that was able to successfully automate our particular custom components; where IBM\'s Rational Functional Tester, Microfocus\' TestPartner, QF-Test, Abbot &amp; FEST <strong>failed</strong>.</p>\n\n<p>I have since been able to successfully integrate the tests with Cruise Control such that they run upon completing each build of the application.</p>\n\n<p>A word of warning though:<br>\n1) 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.<br>\n2) Does not support record/replay of drag-and-drop actions yet.</p>\n'}, {'answer_id': 6246981, 'author': 'NullPumpkinException', 'author_id': 294439, 'author_profile': 'https://Stackoverflow.com/users/294439', 'pm_score': 2, 'selected': False, 'text': '<p>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.</p>\n\n<p>Its expensive, but I think it will pay itself off in a couple of months.</p>\n\n<p>Before QFTest I tried:</p>\n\n<p>1) Automatedqa - good tool, but windows centric and does not understand Swing. Similar to Quick test Pro.</p>\n\n<p>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!</p>\n'}, {'answer_id': 12822044, 'author': 'Tim Ottinger', 'author_id': 15929, 'author_profile': 'https://Stackoverflow.com/users/15929', 'pm_score': 2, 'selected': False, 'text': "<p>Not an answer, but a refining.</p>\n\n<p>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). </p>\n\n<p>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.  </p>\n\n<p>Are there tools that work for non-waterfall testing? </p>\n"}]
['https://Stackoverflow.com/questions/79891', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/13812/']