Your SlideShare is downloading. ×
Fest
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Fest

1,553
views

Published on

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).

Published in: Technology, Art & Photos

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,553
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
18
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

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(&quot;Gandalf&quot;, &quot;Arwen&quot;, &quot;Gimli&quot;); 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