The ZTL language is XML based which describes the operation of a test case for the Selenium Remote Control (RC). For example,
<test tags="button"> <case id="Click"> <server><!-- <zk> <button id="btn" label="Click Me to Show a Message" onClick='alert("Hello!")'/> </zk> --></server> <client> click(btn); waitResponse(); verifyTrue(jq("@window").exists()); </client> </case> </test>
The root tag of the ZTL file is test and encloses one or many test case(s) (similar to each method of the jUnit test case). The case can enclose one or many server and client tags. The content of the server is run on the ZK server, and the content of the client is run on the Selenium server (we called client).
In the above example, the content of the server creates a button (id=btn) which when clicked on will show a "Hello!" message. The content of the client uses btn which is an instance of org.zkoss.ztl.Widget, to fire a Click event to the browser, and then waits for the response from ZK server. Once the response is received the code then checks whether @window exists or not by using the jq API which is implemented by the class org.zkoss.ztl.JQuery.
Unit testing using image differences
In additions to Java, ZTL also allows developers to do unit testing by comparing the screenshot.
For more information, please refer to Vision Test for ZTL.
Last Update : 2011/3/22
|Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.|