Upcoming SlideShare
Loading in...5




A nice way of testing swing component using fest (fixture for easy testing).

A nice way of testing swing component using fest (fixture for easy testing).



Total Views
Slideshare-icon Views on SlideShare
Embed Views



0 Embeds 0

No embeds


Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

    Fest Fest Presentation Transcript

    • 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
      • 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
    • 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
    • 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)
    • 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");
    • 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(&quot;Gandalf&quot;, &quot;Arwen&quot;, &quot;Gimli&quot;); assertThat(yoda).isInstanceOf(Jedi.class).isEqualTo(foundJedi).isNotEqualTo(foundSith);
    • DEMO
      • Verify Title
      • Verify Button Click Behaviour
      • Screenshots when test fails
    • 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
    • FEST
      • Q&A
      • http://fest.easytesting.org/swing/wiki/pmwiki.php