Automated Tests for the Java Swing GUI

What are the options for building automated tests for graphical interfaces written in Java Swing?

I would like to test some of the graphical interfaces that were written using NetBeans Swing GUI Builder , so something that works without requiring special intervention would be ideal code in the test.

+62
java swing testing automated-tests
Sep 18 '08 at 9:25
source share
14 answers

I recently met FEST, which seemed promising, except that the developer announced in 2012 that development would not continue .

AssertJ is a FEST fork that works very well for me. It is actively supported (at the time of writing), supports Java 8, has approvals for several popular libraries, such as Guava and Joda Time, and is very well documented. He is also free and open.

+30
Sep 24 '15 at 21:15
source share

I am currently using FEST . It works with JUnit and will also take screenshots of failed tests.

It has default component search methods that look for the name of the component under test (which must be installed manually), but you can also generate testers for this component by passing it the component.

+26
Sep 18 '08 at 11:15
source share

You can try using Cucumber and Swinger to write functional acceptance tests in plain English for Swing GUI applications. Swinger uses the Jemmy Netbeans library under the hood to control the application.

Cucumber allows you to write tests as follows:

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!" 

Check out this Swinger video to see it in action.

+14
Jun 16 '09 at 11:56
source share

We are considering jemmy to automate some GUI tests. It looks promising.

+9
Apr 24 '10 at 12:45
source share

I am using java.awt.Robot . Not nice, not easy, but it works every time.

Pros:

  • You control
  • Very fast
  • Create your own FWK
  • Portable
  • No external dependencies

Minuses:

  • There is no good graphical interface for creating a test
  • You must leave the GUI yourself while you check
  • Create your own FWK
  • It is difficult to change the test code and create the first posting

Now, if you have a budget, I would go for LoadRunner. Best in class.

(Disclosure: attitude to the company that owns LR, but I worked with LR before the relationship)

+8
Sep 18 '08 at 13:20
source share

I have not used it personally, but SwingUnit looks good. You can use it with jUnit, and it is not based on the "location of the components" (that is, the x and y coordinates).

The only thing you may have to do with the NetBeans GUI Builder is to set unique names for your components.

+6
Sep 18 '08 at 10:25
source share

We use QF-Test and are satisfied.

+6
Sep 18 '08 at 11:39
source share

UISpec4J is quite simple, unsolved and extensible. It fits my goals better than FEST.

+6
Apr 30 '11 at 20:32
source share

Sikuli: GUI tester using screenshots http://sikuli.org/

+3
Jun 28 2018-12-12T00:
source share

You can use the Marathon : "Marathon Integrated Testing Environment, MarathonITE is an affordable, easy-to-use and cross-platform automation platform for Java / Swing β„’ GUI Test. You can use the built-in MarathonITE recorder to store script data to create clean, readable test scripts, or in Python or Ruby. Advanced features such as refactoring with the extract method, creating datadriven-tests, and editing the object map allow you to create repair and maintenance kits with maintenance support. "

+3
Jan 04
source share

You can try ReTest , which is a new tool that implements an innovative approach to functional regression testing and combines it with ai- based on monkey testing. It will also become open source ...

Disclaimer: I am one of the founders of the company for ReTest.

+3
Mar 04 '17 at 22:22
source share

For those with an adventurous mind, there is gooey https://github.com/robertoaflores/Gooey a (very simple and incomplete) software testing tool for swing applications.

+2
Jan 29 '16 at 16:45
source share

Just made a few quick scans. Squash was the most promising. Not free though

+1
Oct 21 '14 at 19:30
source share

You can use sikuli or Automa to test your part of the GUI, these are well-documented and proven tools.

+1
Mar 03 '17 at 11:16
source share



All Articles