Hello
I'm trying to test Apache Lenya with JWebUnit. A very nice testing
framework, thanks.
It went very well, until I reached my first <form>, which threw an error
I can't explain(ReferenceError: "obj" is not defined. (httpunit; line
57) ) . I googled it but found little. Could someone please give me a
hint?
I pasted the error, my test class, and the form below.
Thanks,
Renaud
--
Renaud Richardet
Wyona Inc. - Open Source Content Management - Apache Lenya
office +1 857 776-3195 mobile +1 617 230 9112
[EMAIL PROTECTED] http://www.wyona.com
ReferenceError: "obj" is not defined. (httpunit; line 57)
at
org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:597)
at
org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:557)
at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1076)
at org.mozilla.javascript.gen.c6.call(httpunit:57)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1191)
at org.mozilla.javascript.gen.c1.call(httpunit:21)
at
org.mozilla.javascript.optimizer.OptRuntime.callSimple(OptRuntime.java:275)
at org.mozilla.javascript.gen.c8.call(httpunit:0)
at org.mozilla.javascript.gen.c8.exec(httpunit)
at org.mozilla.javascript.Context.evaluateReader(Context.java:820)
at org.mozilla.javascript.Context.evaluateString(Context.java:784)
at
com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.executeScript(JavaScript.java:122)
at
com.meterware.httpunit.scripting.ScriptableDelegate.runScript(ScriptableDelegate.java:64)
at
com.meterware.httpunit.parsing.ScriptFilter.getTranslatedScript(ScriptFilter.java:150)
at
com.meterware.httpunit.parsing.ScriptFilter.endElement(ScriptFilter.java:131)
at org.cyberneko.html.HTMLTagBalancer.callEndElement(Unknown Source)
at org.cyberneko.html.HTMLTagBalancer.endElement(Unknown Source)
at org.cyberneko.html.HTMLScanner$SpecialScanner.scan(Unknown Source)
at org.cyberneko.html.HTMLScanner.scanDocument(Unknown Source)
at org.cyberneko.html.HTMLConfiguration.parse(Unknown Source)
at org.cyberneko.html.HTMLConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at
com.meterware.httpunit.parsing.NekoHTMLParser.parse(NekoHTMLParser.java:41)
at com.meterware.httpunit.HTMLPage.parse(HTMLPage.java:244)
at
com.meterware.httpunit.WebResponse.getReceivedPage(WebResponse.java:1014)
at
com.meterware.httpunit.WebResponse$Scriptable.load(WebResponse.java:611)
at
com.meterware.httpunit.javascript.JavaScript$Window.initialize(JavaScript.java:424)
at com.meterware.httpunit.javascript.JavaScript.run(JavaScript.java:80)
at
com.meterware.httpunit.javascript.JavaScriptEngineFactory.associate(JavaScriptEngineFactory.java:46)
at
com.meterware.httpunit.RequestContext.runScripts(RequestContext.java:44)
at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:119)
at com.meterware.httpunit.WebWindow.updateWindow(WebWindow.java:141)
at
com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:127)
at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:118)
at com.meterware.httpunit.WebWindow.updateWindow(WebWindow.java:141)
at
com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:127)
at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:118)
at com.meterware.httpunit.WebWindow.sendRequest(WebWindow.java:107)
at
com.meterware.httpunit.WebRequestSource.submitRequest(WebRequestSource.java:245)
at
com.meterware.httpunit.WebRequestSource.submitRequest(WebRequestSource.java:224)
at com.meterware.httpunit.WebForm.doFormSubmit(WebForm.java:75)
at
com.meterware.httpunit.SubmitButton.doButtonAction(SubmitButton.java:47)
at com.meterware.httpunit.Button.click(Button.java:68)
at
net.sourceforge.jwebunit.HttpUnitDialog.clickButton(HttpUnitDialog.java:784)
at net.sourceforge.jwebunit.WebTester.clickButton(WebTester.java:915)
at
net.sourceforge.jwebunit.WebTestCase.clickButton(WebTestCase.java:379)
at
org.apache.lenya.jwebunit.BasicTestCase.testMainPageLinks(BasicTestCase.java:37)
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:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
package org.apache.lenya.jwebunit;
import java.io.File;
import net.sourceforge.jwebunit.WebTestCase;
public class BasicTestCase extends WebTestCase {
ConfigDomParser config;
public BasicTestCase(String name) {
super(name);
try {
config = new ConfigDomParser(new File("properties.xml"));
} catch (Exception e) {
// TODO: handle exception
}
getTestContext().setBaseUrl(getKey("rootUrl"));
}
public void testMainPageLinks() {
beginAt("/");
assertTextPresent(getKey("welcome.text1"));
assertTextPresent("You have successfully installed Apache Lenya");
clickLinkWithText("Default Publication");
assertTitleEquals("Lenya CMS Publication: Default Publication");
clickLinkWithText("Login as Editor");
assertTextPresent("LOGIN to the DEFAULT Publication");
assertFormPresent("login");
setFormElement("username", getKey("default.username"));
setFormElement("password", getKey("default.password"));
clickButton("login");
assertTextPresent("Hello");
}
public String getKey(String key) {
return config.getKey(key);
}
}
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>
LOGIN to the DEFAULT Publication
</title><link title="default css" href="/lenya/css/default.css" type="text/css" rel="stylesheet" /><meta content="application/xhtml+xml; charset=UTF-8"
http-equiv="Content-Type" /></head><body><table cellspacing="0" cellpadding="10" border="0" width="100%"><tr><td class="lenya-header"><h1>
LOGIN to the DEFAULT Publication
</h1></td><td class="lenya-project-logo"><img alt="Apache Lenya Project Logo"
src="/lenya/images/project-logo-small.png" /></td></tr></table><div class="lenya-page-subtitle">
Open Source Content Management System
</div><table cellspacing="0" cellpadding="0" border="0" class="lenya-body"><tr><td
class="lenya-content">
<p>
<strong> NOTE: </strong>
Try user "lenya" and password "levi" (editor), or user "alice" and password
"levi" (reviewer)
</p>
<div class="lenya-box">
<div class="lenya-box-title">
Login
</div>
<div class="lenya-box-body">
<form name="login">
<input type="hidden" name="lenya.continuation"
value="1153293468605f2017317c148d3e3b313351836b" />
<input type="hidden" name="lenya.usecase" value="ac.login" />
<table class="lenya-table-noborder">
<tr>
<td><label for="name">Username: </label></td>
<td>
<input class="lenya-form-element" name="username" type="text" />
</td>
</tr>
<tr>
<td><label for="password"> Password: </label></td>
<td>
<input class="lenya-form-element" name="password" type="password"
/>
</td>
</tr>
<tr>
<td />
<td>
<input name="submit" id="login" type="submit" value="Login" />
</td>
</tr>
</table>
</form>
</div>
</div>
</td></tr></table></body></html>
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Jwebunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-users