How to Run the ZTL Test Cases

From Documentation
DocumentationZTL EssentialsGetting StartedHow to Run the ZTL Test Cases
How to Run the ZTL Test Cases



Checkout Source Code

You need to check out the ZTL project from here. You should now be able to see the following folders under ztl:

  • javadoc the Javadoc of the ZTL core.
  • lib the libraries required for this project.
  • selenium-server... the selenium server.
  • src the source code of the ZTL core.
  • test the directory of the ZTL testing file.

Add Listener into zk.xml

Add a desktop listener to zk.xml. For example,

<listener>
	<description>For Zul Testing Language</description>
	<listener-class>org.zkoss.zktest.test2.DesktopInit</listener-class>
</listener>

Note: the implementation class was added in ZK 5.0.1 release, you can also implement your own listener. For example,

public class DesktopInit implements org.zkoss.zk.ui.util.DesktopInit {
	
	public void init(final Desktop desktop, Object request) throws Exception {
		desktop.addListener(new AuService() {

			public boolean service(AuRequest request, boolean everError) {
				final String cmd = request.getCommand();
				if (cmd.equals("onZTLService")) {
					String zscript = (String) request.getData().get("");
					Component cmp = Executions.createComponentsDirectly(
							zscript, "zul", null, null);
					if (cmp != null)
						cmp.setPage((Page) desktop.getPages().iterator().next());
					return true;
				} else return false;
			}
		});
	}

}

Configure ZTL Setting

Configure your server settings under src/config.properties

Name Description Overridden in ZTL file
client the URL of the selenium server yes
server the URL of the ZK server yes
context-path the name(/zkdemo) of the context path, like http://localhost:8080/zkdemo yes
delay the delay time of each command run by Selenium yes
action by default, the service.zul is assumed, like http://localhost:8080/zkdemo/service.zul yes
timeout the timeout of the waiting response from ZK server, in millisecond yes
browser each test case should be tested with all browser types, by default "all" is assumed yes
all describes how many browser type should be tested no
  • Note: Overridden in ZTL file means the property can be overridden in each ZTL file, if necessary.

Start Server

Start the Selenium server and ZK server.

  • Run with startup.bat under selenium-server directory.
  • Run your ZK server.

Run Test Case and Report

Run the test case and reports using runProject.bat under the ztl directory.

More Details

Please refer to Command Line Setting



Last Update : 2022/01/19

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.