1 / 11

Automated UI testing of Swing based applications

Automated UI testing of Swing based applications. Tomas Krecmer Barclays 27. February 2012. UI testing. What do we want to test? Custom widgets Data models Business logic What not? Swing 3 rd party widgets, windowing framework Server functions via client

dustin
Download Presentation

Automated UI testing of Swing based applications

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Automated UI testing of Swing based applications Tomas Krecmer Barclays 27. February 2012

  2. UI testing • What do we want to test? • Custom widgets • Data models • Business logic • What not? • Swing • 3rd party widgets, windowing framework • Server functions via client • How do we implement the tests? • Who to implement • What technology

  3. Testing of existing application • Usually not fine grained – business logic mixed up with UI code • Server calls from widgets • Controllers polluted by UI updates • Idea not to rewrite anything • Hard to mock up • Missing names of the widgets to identify them on the screen

  4. Test your application by external program • Test your application by external program • Simulates user interaction • Run against dedicated environment needed • No major changes to application itself (just add names to widgets) • Technologies like HP QTP (Mercury), Silk • Testing scripts written in scripting language like Visual Basic. Tests can be written by QA team • Library to navigate on custom widgets • Expensive, slow

  5. Unit testing - approaches • Pure unit tests for isolated functionality (widgets, controllers, models) • For mixed up code - initialize whole application from Unit test against reference environment. Testing thread interacts with UI (through UI thread) and verifies expected results. No need for mocking.

  6. Unit test technologies • TestNG – general purpose Unit testing framework • More advanced than JUnit • Supported by other technologies (ant, TeamCity, Eclipse, FEST, JMockit) • FEST – Swing testing framework • Pure Java framework • Simulates user interaction • Heavy support for widget’s look up • Needs to initialize UI ei. must be run on Windows box • Good UI thread management • Other framework under investigation (UISpec4J, Jemmy, Abbot, jfcUnit) • Takes screenshot on failure

  7. FEST example Verify when password not set error dialog is displayed DialogFixture dialog = frame.dialog(“login”);  dialog.textBox("username").enterText("alex.ruiz“); dialog.button("ok").click();  dialog.optionPane().requireErrorMessage()                    .requireMessage("Please enter your .*"); // regular expression matching

  8. Integration with Dev Process • Run as part of Continuous Integration • Set up for each DEV branch • Results are used as a test evidence for releases • Dedicated Windows box

  9. Reality • Originally 1200 manual testing scenarios existed • Converted to 270 unit tests • Covers 800 of original scenarios • Total run 2.5 hours • Total implementation cost about 120 MDs • Saved 40MDs per release

  10. The End • Q&A

  11. Links • http://www.barcap.com/ • http://testng.org/doc/index.html • http://code.google.com/p/fest/ • http://code.google.com/p/jmockit/

More Related