Sunday, October 23, 2011

ZKoss UI testing experience

Recently I had experience of developing small set of web applications for internal use. These applications were based on ZKoss AJAX UI framework. During development me and my teammates realized that we need set of UI test just because it easier and faster to test our work automatically than manually.

To solve this issue I take a look at Selenium. We realized that we can’t test ZKoss applications by Selenium itself; we need some additions because id’s of UI elements have been generated automatically by ZKoss (see presentation about it at slideshare and video (Ukrainian language) here ).

Fortunately ZK team have made testing framework on the top of Selenium to test their components. So I made a fork of this framework at github and modified it for our purposes (instead of component testing our team needed to make an integration tests).

So we received an ability to locate UI elements by different parameters. We choose next sets of parameters for this purpose:

  1. ZKoss element id (not an javascript id)
  2. ZKoss element type and caption (i.e. @menu[label=”File”])
  3. ZKoss element type, caption and modal form on which it located (i.e. @window[title=”Error”] @button[label=”Close”])

All these approaches works fine at the moment.

Also we have some issues:

  1. With two similar applications we have different behavior of internet explorer WebDriver (it’s related to issue http://code.google.com/p/selenium/issues/detail?id=2247). With one application we see unnecessary scrollbar and with other we don’t see it.
  2. We still can’t run htmlunit tests with our application.
  3. We still can’t run component tests with ZTL-2 and this will be subject of future investigation.
P.S. Also there is a brunch at ZKoss forum related to subject http://www.zkoss.org/forum/listComment/17556-ZTL-issues

1 comment: