0

Help using ZTL - Jboss - zAu.send Error

asked 2011-07-25 13:00:20 +0800

ansancle gravatar image ansancle
317 9

updated 2011-07-25 14:00:15 +0800

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.

delete flag offensive retag edit

13 Replies

Sort by ยป oldest newest

answered 2011-11-18 15:30:33 +0800

laranjeiro gravatar image laranjeiro
12

Hi, could you figure the solution? I'm having the same problem.

link publish delete flag offensive edit

answered 2011-11-18 16:19:49 +0800

laranjeiro gravatar image laranjeiro
12

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

link publish delete flag offensive edit

answered 2011-11-18 18:33:40 +0800

ansancle gravatar image ansancle
317 9

I never did figure this out, sorry

link publish delete flag offensive edit

answered 2011-11-21 09:42:38 +0800

vincentjian gravatar image vincentjian
2245 6

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?

link publish delete flag offensive edit

answered 2011-11-21 10:43:24 +0800

laranjeiro gravatar image laranjeiro
12

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();	
			}
		}
	}
}



link publish delete flag offensive edit

answered 2011-11-22 03:13:00 +0800

vincentjian gravatar image vincentjian
2245 6

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?

link publish delete flag offensive edit

answered 2011-11-28 09:45:38 +0800

laranjeiro gravatar image laranjeiro
12

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)

link publish delete flag offensive edit

answered 2011-12-02 03:54:30 +0800

vincentjian gravatar image vincentjian
2245 6

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.

link publish delete flag offensive edit

answered 2012-05-23 08:46:52 +0800

petrd gravatar image petrd
9

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,

link publish delete flag offensive edit

answered 2012-05-24 07:16:13 +0800

petrd gravatar image petrd
9

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,

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2011-07-25 13:00:20 +0800

Seen: 767 times

Last updated: Jun 17 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More