-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I am trying to get started using ZTL - I have followed all the instructions but still have a few questions.
I have read through all the documentation/smalltalks and even watched the youtube video, but I am still confused on how to start testing my application which is run on jboss. Do I add the ztl.jar into my buildpath, then create .ztl files for my zul files? In my config.properties what should the "action" entry be set to? I guess I am not making the connection between what I have downloaded and how I can get it to run against my existing application. (The fact I can't even get the base examples to run without error isn't helping).
Anyone that has done this before I would appreciate learning how to setup my existing app so I can test.
When I run the basic test using a zul file for the "action" that looks like this :
<?xml version="1.0" encoding="UTF-8"?> <?page title="ZK ${desktop.webApp.version}"?> <zk> </zk>
I get the following errors in the selenium server output
Command request: getEval[zAu.send(new zk.Event(null, 'onZTLService', ' <window title="My First window" border="normal" width="200px"> <label value="Hello, World!" /> <button label="Hi" onClick=\'alert("Welcome")\'/> </window> ', 10)), ] on session 16135508cdd34faeb68c9a157c09db7e
15:02:28.466 INFO - Got result: ERROR: Threw an exception: zAu is not defined on session 16135508cdd34faeb68c9a157c09db7e
Any help greatly appreciated - I am thrashing on this now.
Hi, could you figure the solution? I'm having the same problem.
More Information about my problem.
I'm current using ztl to generate some JUnit test. I add a DesktopInit to my project and the related listener.
I have the actions in ztl:
<client><![CDATA[ username.set("value", "laranjeiro"); click(login); ]]></client>
It generate the java file without any problems.
I start my ZK project in the server, Server Selenium 1.0.1 and chrome driver. I start the JUnit test, it start the server and them in, while executing runZscript(zscript) give me the following error:
com.thoughtworks.selenium.SeleniumException: ERROR: Threw an exception: zAu is not defined at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97) at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91) at com.thoughtworks.selenium.HttpCommandProcessor.getString(HttpCommandProcessor.java:262) at com.thoughtworks.selenium.DefaultSelenium.getEval(DefaultSelenium.java:443) at org.zkoss.ztl.ZKTestCase.getEval(ZKTestCase.java:546) at org.zkoss.ztl.ZKClientTestCase.runZscript(ZKClientTestCase.java:75) at loginTest.testztl(loginTest.java:108) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at junit.framework.TestCase.runTest(TestCase.java:168) at junit.framework.TestCase.runBare(TestCase.java:134) at org.zkoss.ztl.ZKSeleneseTestCase.runBare(ZKSeleneseTestCase.java:292) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at junit.framework.TestSuite.runTest(TestSuite.java:243) at junit.framework.TestSuite.run(TestSuite.java:238) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Best Regards
Hi all,
The "action" entry is the zul page you want to test.
I have tried ZTL test followed by document and works fine.
Could you provide the ztl file and generated JUnit test java code?
ZTL File
<!-- index.ztl.java Purpose:for testing index.ztl . Description: History: 11, 21, 2011 10:42:10 Copyright (C) 2011 Potix Corporation. All Rights Reserved. This program is distributed under Apache License Version 2.0 in the hope that it will be useful, but WITHOUT ANY WARRANTY. --> <test tags="index.zul"> <case id="ztl"> <server><!-- <?page title="Auto Generated index.zul"?> <window> <textbox id="name" value="Jerry" width="150px" /> <button id="btn" label="Left" width="125px" onClick='mailPop.open(self)' /> <popup id="mailPop" width="150px"> <groupbox sclass="z-demo-config" closable="false" > <caption>This is Popup</caption> </groupbox> </popup> <textbox value="Kramer" width="150px" /> <textbox value="Elaine" width="150px" /> </window> --></server> <client><![CDATA[ click(btn); ]]></client> </case> </test>
Generated Java File
/* indexTest.java Purpose: Description: History: Nov, 21, 2011 10:43:20 AM Copyright (C) 2011 Potix Corporation. All Rights Reserved. This program is distributed under Apache License Version 2.0 in the hope that it will be useful, but WITHOUT ANY WARRANTY. */ import org.junit.Test; import org.zkoss.ztl.Element; import org.zkoss.ztl.JQuery; import org.zkoss.ztl.Tags; import org.zkoss.ztl.Widget; import org.zkoss.ztl.ZK; import org.zkoss.ztl.ZKClientTestCase; import org.zkoss.ztl.util.ColorVerifingHelper; import com.thoughtworks.selenium.Selenium; @Tags(tags = "index.zul") public class indexTest extends ZKClientTestCase { public indexTest() { target = "http://localhost:8080/ZKTest/index.zul"; browsers = getBrowsers("all", false); _timeout = 60000; caseID = getClass().getSimpleName(); } @Test(expected = AssertionError.class) public void testztl() { for (Selenium browser : browsers) { try { start(browser); windowFocus(); windowMaximize(); String zscript = ""; Widget engine = new Widget(new StringBuffer("zk.Desktop._dt")); // remove all of unnecessary children if (target.endsWith("/service.zul")) removeChildren(engine.firstChild()); /** start **/ /** server code **/ zscript = "" + " <?page title=\"Auto Generated index.zul\"?>" + "<window>" + " <textbox id=\"name\" value=\"Jerry\" width=\"150px\" />" + " <button id=\"btn\" label=\"Left\" width=\"125px\" onClick=\\'mailPop.open(self)\\' />" + " <popup id=\"mailPop\" width=\"150px\">" + " <groupbox sclass=\"z-demo-config\" closable=\"false\" >" + " <caption>This is Popup</caption> " + " </groupbox>" + " </popup>" + " <textbox value=\"Kramer\" width=\"150px\" />" + " <textbox value=\"Elaine\" width=\"150px\" />" + " " + "</window>" + " " ; runZscript(zscript); Widget name = engine.$f("name"); Widget btn = engine.$f("btn"); Widget mailPop = engine.$f("mailPop"); waitResponse(); /** client code **/ click(btn); /** end **/ } finally { stop(); } } } }
Hi laranjeiro,
The ztl file and java code works fine for me to run JUnit.
Could you describe your steps to run the ZTL test?
Start ZKTest in server
3 - If chrome browser is used, start chromedriver.exe
4 - Start selenium-server-1.0.1->startup.bat
5 - In ztl project codegen-> default package -> run indexTest.java as Junit Test
In JUnit Tab -> Failure Trace presents the following error
com.thoughtworks.selenium.SeleniumException: ERROR: Threw an exception: zAu is not defined
at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
at com.thoughtworks.selenium.HttpCommandProcessor.getString(HttpCommandProcessor.java:262)
at com.thoughtworks.selenium.DefaultSelenium.getEval(DefaultSelenium.java:443)
at org.zkoss.ztl.ZKTestCase.getEval(ZKTestCase.java:547)
at org.zkoss.ztl.ZKClientTestCase.runZscript(ZKClientTestCase.java:75)
at indexTest.testztl(indexTest.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Hi laranjeiro,
1. You should start the project you want to test in server, not ZKTest.
2. I didn't start chromedriver.exe but still work fine. I am not sure if it is necessary.
I have the same problem - can't get an empty simple test to run. Can't figure it out.
I started my ZK application, then started test with eclipse - run as junit test
- it opens chrome,
- in the chrome is my zul page displayed,
- test runs until runZscript(zscript) which crashes with following exception and same callstack as above;
then Got result: ERROR: Threw an exception: zAu is not defined on session 5c709cd3643d43aab0a3faf94e6713aa
the command given to executeCommandOnServlet is cmd=getEval&1=zAu.send%28new+zk.Event%28null%2C+%27onZTLService%27%2C+%27+%3Czk%3E+++++%3Cbutton+id%3D%22click%22+label%3D%22Click+Me+to+Show+a+Message%22+onClick%3D%5C%27alert%28%22Hello%21%22%29%5C%27%2F%3E%3C%2Fzk%3E%27%2C+10%29%29
ZK - 6.0.0
Selenium - selenium-server-standalone-2.21.0
Any ideas ?
Thanks,
Hi all,
I also wonder where the zAu class is defined. I found http://www.zkoss.org/javadoc/6.0.0/jsdoc/_global_/zAu.html but found the class nowhere in the sources I downloaded ( both ZK and ZTL), not even in .class or jar form. But it is called in many places. Where is the zAu defined ?
Thanks,
Asked: 2011-07-25 13:00:20 +0800
Seen: 767 times
Last updated: Jun 17 '13