[Webtest] scriptStep: JavaScriptEngine not found

Marc Guillemot webtest@lists.canoo.com
Fri, 14 Apr 2006 15:45:46 +0200


Hi Philippe,

I can't say anything about the cause of your error but I suppose that
your example shows a (common) misunderstanding concerning script step:
scriptStep like the groovy step allows to script webtest not to run js
in the scope of the currently loaded page (at least not directly).

Marc.

Philippe Schoch wrote:
> Hi,
> 
> I have an exception, that the javascript engine cannot be found at
> 'scriptStep'.
> 
> [scriptStep] ERROR (org.apache.bsf.BSFManager) - Exception :
> [scriptStep] java.lang.ClassNotFoundException:
> org.apache.bsf.engines.javascript.JavaScriptEngine
> [scriptStep] at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
> [scriptStep] at java.security.AccessController.doPrivileged(Native Method)
> [scriptStep] at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
> [scriptStep] at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
> [scriptStep] at
> sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
> [scriptStep] at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
> [scriptStep] at org.apache.bsf.BSFManager.loadScriptingEngine(Unknown
> Source)
> [scriptStep] at org.apache.bsf.BSFManager.exec(Unknown Source)
> [scriptStep] at
> com.canoo.webtest.boundary.ResetScriptRunner.executeScript(ResetScriptRunner.java:131)
> 
> [scriptStep] at
> com.canoo.webtest.extension.ScriptStep.executeByRunner(ScriptStep.java:101)
> [scriptStep] at
> com.canoo.webtest.extension.ScriptStep.doExecute(ScriptStep.java:62)
> ...
> 
> This sounds strange to me because my WEBTEST_HOME\lib dir contains
> 'bsf-20060305.jar' where
> 'org.apache.bsf.engines.javascript.JavaScriptEngine' can be found.
> Also the     <import file="${webtest.home}/lib/classpath.xml"/> 
> statement doesn't help more (as I actually expected cause other
> classpath elements can be found by webtest).
> 
> Can anybody help me what I have to consider running the scriptStep?
> 
> Cheers,
> Phil
> 
> <project name="ProfeOfConcept" basedir=".." default="POC">
>      <property name="webtest.home" location="C:/Programme/canoo-webtest" />
>    <property name="field.hidden.name" value="_test:_idcl" />
>    <property name="field.hidden.value" value="_id0" />      <import
> file="${webtest.home}/lib/taskdef.xml"/>      <import
> file="${webtest.home}/lib/classpath.xml"/>
> 
>    <target name="POC">
>        <webtest name="POC">
>            &config;
>            <steps>
>                <invoke
>                    description="get the test.faces page"
>                    url="test.faces" />
>                <verifyText
>                    description="the only text on the page"
>                    text="Test" />
>                <scriptStep
>                    description="emulate command-link onclick-javascript
> code"
>                    language="javascript">
>                   
> document.forms['_test']['_test:_idcl'].value='_test:_id0';
> document.forms['_test'].submit(); return false;
>                </scriptStep>                      </steps>
>        </webtest>
>    </target>
> </project>
>