1 / 10

FEST(A)! - TESTING SWING COMPONENTS WITH FEST

FEST(A)! - TESTING SWING COMPONENTS WITH FEST. Andreas Enbohm, Capgemini. Agenda . Basics of FEST Code Examples and Demo B & C’s How ERE uses Fest Q&A. FEST. Fixtures For Easy Software Testing, released nov - 08 Java-based framework, works with JUnit, TestNG, standalone

Télécharger la présentation

FEST(A)! - TESTING SWING COMPONENTS WITH FEST

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. FEST(A)!- TESTING SWING COMPONENTS WITH FEST Andreas Enbohm, Capgemini

  2. Agenda • Basics of FEST • Code Examples and Demo • B & C’s • How ERE uses Fest • Q&A

  3. FEST • Fixtures For Easy Software Testing, released nov - 08 • Java-based framework, works with JUnit, TestNG, standalone • Several modules in FEST (swing, assert, reflect, mocking) • ’Fluent Interface’ (a.k.a. internal DSL) • Features: • Simulation of user interaction with a GUI (e.g. mouse and keyboard input) • Reliable GUI component lookup (by type, by name or custom search criteria) • Support for all Swing components included in the JDK • Supports Applet testing • Ability to embed screenshots of failed GUI tests in HTML test reports • Verifying colors and fonts

  4. FEST – Swing Module • Supported Input - Mouse- Keyboard- Drag ’n Drop • Support of Running Tests without any desktop installed- Xvfb- Good for both CI and local environment • Apache 2.0 License, Hosted at Google Code

  5. FEST – Swing Module • Fixtures- one fixture per swing component (e.g. JButtonFixture)- provide method for user interaction, button.click()- implicit assertions, if ’click’ fails an assertion error is thrown- good for testing ’single’ UI component (see demo) • Robot- used for looking up various components- used for more low level operations robot.click(component)- requires more work than using fixtures- needs to be used if testing ’running application’ (see demo)

  6. FEST – Swing Module • Simple Example FrameFixture dialog = new FrameFixture(new MyFrame()); dialog.comboBox("domain").select("Users"); dialog.textBox("username").enterText(“Chuck Norris"); dialog.button("login").click(); //Assert we have an error message dialog.optionPane().requireErrorMessage().requireMessage("Please enter your password");

  7. FEST - Extensions • FEST – Assert with fluent interfaces • FEST – Reflect • FEST – Mocking int removed = employees.removeFired(); assertThat(removed).isZero(); List<Employee> newEmployees = employees.hired(TODAY); ‘ assertThat(newEmployees).hasSize(6).contains(frodo, sam); String[] newHires = employees.newHiresNames(); assertThat(newHires).containsOnly("Gandalf", "Arwen", "Gimli"); assertThat(yoda).isInstanceOf(Jedi.class).isEqualTo(foundJedi).isNotEqualTo(foundSith);

  8. DEMO • Verify Title • Verify Button Click Behaviour • Screenshots when test fails

  9. FEST – B & C’s • Easy to begins with, very much like writing ’usual’ tests • Taking screenshots when test failures • Good documentation • Access / update GUI components – should be done via EDT • Different behaviour (i.e. focus problem, Z-order of windows) of different platforms. May result in test failure • Not possible to record user interaction • Test takes long time to run

  10. FEST • Q&A http://fest.easytesting.org/swing/wiki/pmwiki.php

More Related