Test-driven GUI development with FEST

By javatron

Wow, this is a very interesting framework for JAVA GUI APIs…

———

http://code.google.com/p/fest/

Do you want to see FEST in action? Check the article “Test-driven GUI development with FEST” by Alex Ruiz. Video demonstrations and working code examples are included!

FEST is a collection of APIs, released under the Apache 2.0 license, which mission is to simplify software testing. It contains the following modules:

Swing Module:

  • DSL-oriented API for functional Swing GUI testing
  • Simulation of user-generated events and reliable GUI component lookup
  • Easy-to-use and powerful API that simplifies creation and maintenance of Swing GUI functional tests:
  •     dialog.comboBox("domain").select("Users");
        dialog.textBox("username").enterText("alex.ruiz");
        dialog.button("ok").click();
        dialog.optionPane().requireErrorMessage()
                           .requireMessage("Please enter your password");
  • Supports both JUnit and TestNG
  • Ability to take screenshots of failed GUI tests and embed them in a HTML report (JUnit and TestNG)
  • Experimental Groovy Builder support for creating GUI tests

Assertions Module:

  • ‘Flexible’ or ‘fluent’ assertions:
  •    assertThat(yoda).isInstanceOf(Jedi.class)
                       .isEqualTo(foundJedi)
                       .isNotEqualTo(foundSith);
  • Assertions for Object, String, arrays (including primitives), primitives, collections, images and more!
  • Assertions can be extended using custom Conditions

Reflection Module:

  • Fluent interface‘ for simplifying usage of reflection:
  •     Person person = constructor().withParameterTypes(String.class)
                                     .in(Person.class)
                                     .newInstance("Yoda");
    
        method("setName").withParameterTypes(String.class)
                         .in(person)
                         .invoke("Luke");
    
        field("name").ofType(String.class)
                     .in(person)
    
                     .set("Anakin");

Mocks Module:

  • Eliminates code duplication when using mock objects
  • Clearly separates mock expectations from code to test, improving code readability

Project links:

Leave a Reply