My favorites | Sign in
Project Logo
                
Blogs:
Feeds:
People details
Project owners:
  paul.szulc

The aim of this project is to create an extension of existing WicketTester class. Even though WicketTester gives greate API for integration tests, it has its flaws. Enhanced WicketTester tries to address those issues.

Should I use it?

If you still wonder whether you should use Enhanced WicketTester, check out author's blog post about WicketTester pitfalls and API issues.

How to add it to my project?

Maven users

Add following line to your pom, in dependencies section:

<dependency>
  <groupId>pl.rabbitsoftware</groupId>
  <artifactId>enhancedwickettester</artifactId>
  <version>1.0.0</version>
  <scope>test</scope>
</dependency>

Also make your project aware of Enhanced WicketTester maven repository, by adding at the end of yor pom:

<repositories>
  <repository>
    <id>enhancedwickettester</id>
    <url>http://enhancedwickettester.googlecode.com/svn/repo</url>
  </repository>
</repositories>

Other (Ant ect.)

Download latest version of Enhanced WicketTester and add it to your classpath.

How to use it in my project?

To use use Enhanced WicketTester, you have to instantiated it with normal WicketTester as a parameter:

WicketTester tester = new WicketTester();
EnhancedWicketTester enhanced =
             new EnhancedWicketTester(tester);

For clicking on links, you currently got three methods:

enhanced.clickLink("link");
enhanced.clickAjaxLink("ajaxLink");
enhanced.clickSubmitLink("formPath","submitLink");

Before doing the actual clicking, those methods will not only check if given links exist and are visible, but also if they are of a given type.

Also with Enhance WicketTester you can now check whether any of your components is disabled or enabled.

enhanced.assertEnabled("path");
enhanced.assertDisabled("path");

Worth noticing is fact, that Enhanced WicketTester gives you slightly changed API for form filling. Imagine for example that you want to fill given form with values:

<form wicket:id="loginForm">
  Login: <input wicket:id="login" />
  Password: <input wicket:id="password" />
  Time zone: <select wicket:id="timezone" />
  <input type="button" value="Log in"
                      wicket:id="loginButton" />
</form>

Doing it in Enhaned WicketTester would look like this:

enhanced.form("loginForm")
     .setTextFieldValue("login", "admin")
     .setPasswordTextFieldValue("password", "pass")
     .selectDropDownChoice("timezone", 1)
     .submitWithButton("loginButton");

Enhanced WicketTester not only will check whether all given components exists, but also if the are visible and enabled. Explicitly telling that you are setting TextField (method setTextFieldValue) and not for example TextArea (method setTextAreaValue) makes your test even more type-safe and therefore robust.









Hosted by Google Code