You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Matt Raible <li...@raibledesigns.com> on 2004/12/05 07:13:28 UTC

Testing MyFaces with Canoo's WebTest

I'm trying to use Canoo's WebTest to test my JSF app.  I've found that I 
have to have JavaScript enabled in order to test commandLinks and such. 
  However, the problem I'm having is that WebTest throws a NPE on a page 
with a commandLink:

    [canoo] [appfuse] ERROR [main] Step.handleUnexpectedException(370) | 
Cannot
andle unexpected exception in step ClickButton at 
C:\Source\appfuse-jsf\test\we
\login.xml:6:  with (label="Login", stepId="Click the submit button", 
stepType=
clickbutton")
    [canoo] java.lang.RuntimeException: Script 'function clear_editUser() {
    [canoo]   var f = document.forms['editUser'];
    [canoo]   f.elements['editUser:_link_hidden_'].value=null;
    [canoo]   f.target='_self';
    [canoo] }
    [canoo] clear_editUser();
    [canoo] //' failed: java.lang.NullPointerException
    [canoo]     at 
com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine
handleScriptException(JavaScript.java:199)
    [canoo]     at 
com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine
executeScript(JavaScript.java:136)
    [canoo]     at 
com.meterware.httpunit.scripting.ScriptableDelegate.runScript

It looks like it's bombing on the generated clear_editUser() function. 
If I do a view source on my page, my guess is that the call to get the 
form is failing b/c the JavaScript is above the </form> - rather than 
below it.

Has anyone been successful in using tools like Canoo or jWebUnit to test 
their JSF apps?

Thanks,

Matt


Re: Testing MyFaces with Canoo's WebTest

Posted by Matt Raible <li...@raibledesigns.com>.
Upgrading to the latest Canoo WebTest distribution (build 574) solved 
this issue.

Matt

Matt Raible wrote:

> I'm trying to use Canoo's WebTest to test my JSF app.  I've found that 
> I have to have JavaScript enabled in order to test commandLinks and 
> such.  However, the problem I'm having is that WebTest throws a NPE on 
> a page with a commandLink:
>
>    [canoo] [appfuse] ERROR [main] Step.handleUnexpectedException(370) 
> | Cannot
> andle unexpected exception in step ClickButton at 
> C:\Source\appfuse-jsf\test\we
> \login.xml:6:  with (label="Login", stepId="Click the submit button", 
> stepType=
> clickbutton")
>    [canoo] java.lang.RuntimeException: Script 'function 
> clear_editUser() {
>    [canoo]   var f = document.forms['editUser'];
>    [canoo]   f.elements['editUser:_link_hidden_'].value=null;
>    [canoo]   f.target='_self';
>    [canoo] }
>    [canoo] clear_editUser();
>    [canoo] //' failed: java.lang.NullPointerException
>    [canoo]     at 
> com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine
> handleScriptException(JavaScript.java:199)
>    [canoo]     at 
> com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine
> executeScript(JavaScript.java:136)
>    [canoo]     at 
> com.meterware.httpunit.scripting.ScriptableDelegate.runScript
>
> It looks like it's bombing on the generated clear_editUser() function. 
> If I do a view source on my page, my guess is that the call to get the 
> form is failing b/c the JavaScript is above the </form> - rather than 
> below it.
>
> Has anyone been successful in using tools like Canoo or jWebUnit to 
> test their JSF apps?
>
> Thanks,
>
> Matt