You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Kevin Menard <km...@servprise.com> on 2006/06/26 17:45:30 UTC

HTMLUnit & Tapestry 4.1

Has anyone here tried to test their Web app with HTMLUnit using Tapestry  
4.1?  I'm getting a lot of errors related to embedded dojo stuff, even  
with JavaScript disabled in the web client.  Any help would be greatly  
appreciated.

Thanks,
Kevin

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: HTMLUnit & Tapestry 4.1

Posted by Jesse Kuhnert <jk...@gmail.com>.
We should have a seperate tapestry-testing project out soon that will help
with some of these things. (builds off of
http://howardlewisship.com/tapestry-javaforge/tapestry-testng/ to support
TestNG as the base testing framework) Things are still a little hairy right
now but it should be done soon-ish.

You also have http://jrex.mozdev.org/ which may or may not be what selenium
is using to do its headless server mode stuff.

All of this is still a little frustrating for me at times, but I'm trying to
keep myself up to date on the latest things when I can...Someone told me
that it is planned to eventually move firefox/thunderbird over to the new
XPCOM based platform in the future, which would allow us to create unit
tests that actually run in the browser without having to install a brand new
set of mozilla libs just for testing...(ie xulrunner )

The new tapestry test project will host some basic utilities for testing
tapestry components/pages (mostly via easymock.org type enhancements) , but
will also support testing "pure" javascript functional testing via the rhino
interpreter. (still can't test full browser mode as rhino doesn't have a
browser API, but I've been doing a little mock-like functionality in these
tests for the new tapestry release and have found it to work out pretty well
so far).

On 6/27/06, Kevin Menard <km...@servprise.com> wrote:
>
> On Tue, 27 Jun 2006 07:24:35 -0400, D&J Gredler <dj...@gmail.com>
> wrote:
>
> > Do you mean to say that it's still executing JavaScript when you disable
> > it?
>
> It appears that if the JavaScript is embedded in a page, HTMLUnit will
> attempt to do something with it, regardless of whether JavaScript is
> enabled in the WebClient.  I'd have to dig into it a bit more, but that's
> what the exception message seems to indicate.
>
> > Or that it's having trouble parsing files? You might want to file a bug
> > report to the HtmlUnit tracker... If I remember correctly, you're also
> > supposed to be able to rip out the Rhino js.jar file to disable
> > JavaScript...
>
> Hmm . . . maybe I'll give that a try.  I think in the long run, I'm going
> to want to migrate away from this anyway.
>
> --
> Kevin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.

Re: HTMLUnit & Tapestry 4.1

Posted by Kevin Menard <km...@servprise.com>.
On Tue, 27 Jun 2006 07:24:35 -0400, D&J Gredler <dj...@gmail.com>  
wrote:

> Do you mean to say that it's still executing JavaScript when you disable  
> it?

It appears that if the JavaScript is embedded in a page, HTMLUnit will  
attempt to do something with it, regardless of whether JavaScript is  
enabled in the WebClient.  I'd have to dig into it a bit more, but that's  
what the exception message seems to indicate.

> Or that it's having trouble parsing files? You might want to file a bug
> report to the HtmlUnit tracker... If I remember correctly, you're also
> supposed to be able to rip out the Rhino js.jar file to disable
> JavaScript...

Hmm . . . maybe I'll give that a try.  I think in the long run, I'm going  
to want to migrate away from this anyway.

-- 
Kevin

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: HTMLUnit & Tapestry 4.1

Posted by D&J Gredler <dj...@gmail.com>.
Do you mean to say that it's still executing JavaScript when you disable it?
Or that it's having trouble parsing files? You might want to file a bug
report to the HtmlUnit tracker... If I remember correctly, you're also
supposed to be able to rip out the Rhino js.jar file to disable
JavaScript...

On 6/26/06, Kevin Menard <km...@servprise.com> wrote:
>
> On Mon, 26 Jun 2006 12:17:26 -0400, Jesse Kuhnert <jk...@gmail.com>
> wrote:
>
> > I tried a while back with no luck. It's a very admirable attempt at
> > mimicking the browser but not quite complete enough to handle the likes
> > of
> > dojo...
>
> Heh, I would be fine with that if the disable JavaScript option actually
> ignored all JavaScript.
>
> > For this type of integration testing I would reccomend using selenium.
> > (tacos uses this currently )
>
> That's what I was thinking.  I'll give it a go.  I'm a bit hesitant since
> when I last looked (back in November), the documentation was absolutely
> atrocious.
>
> Thanks,
> Kevin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: HTMLUnit & Tapestry 4.1

Posted by Paul Field <pa...@db.com>.
> Firing up the Web browser, on the other hand, may
> be.  Do you happen to have any experience setting this up on a headless
> build server?

That's next on our list :-) We're experimenting locally with the tests to prove how useful Selenium is and, if we like it (going well so far!) we'll move it into our continuous integration and/or nightly builds.

However, this wiki page has relevant information:

http://wiki.openqa.org/display/SRC/Selenium-RC+and+Continuous+Integration


Paul

------------------
Paul Field
Global Markets Research IT
Deutsche Bank
---

This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: HTMLUnit & Tapestry 4.1

Posted by Kevin Menard <km...@servprise.com>.
On Tue, 27 Jun 2006 07:52:43 -0400, Paul Field <pa...@db.com> wrote:

> One other thing is that the "Selenium" object that represents your  
> session is very expensive to create (it requires creating an instance of  
> the web browser). You can use JUnit setUp/tearDown around a suite so  
> that you only create it once (or use @BeforeClass/@AfterClass in Junit  
> 4). However, I've found that with @BeforeClass/@AfterClass you have  
> suite==class and all your tests for the session need to be in one class.  
> I've found that TestNG's concept of a suite is much more suitable as it  
> can span multiple classes and you can its 'groups' concept to run  
> subsets of the tests (http://testng.org/).

Thanks for the info.  I'll be using TestNG, so that front doesn't sound  
like it'll be an issue.  Firing up the Web browser, on the other hand, may  
be.  Do you happen to have any experience setting this up on a headless  
build server?  I realize this is going way OT, so if you want to take it  
off the list, feel free.

Thanks,
Kevin

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: HTMLUnit & Tapestry 4.1

Posted by Paul Field <pa...@db.com>.
> > For this type of integration testing I would reccomend using selenium.
> > (tacos uses this currently )
>
> That's what I was thinking.  I'll give it a go.  I'm a bit hesitant since
> when I last looked (back in November), the documentation was absolutely
> atrocious.

We're just starting to use Selenium at the moment, so I'll just share a couple of things you might find useful.

One of the problems I found with "Plain" selenium is that you can't organise your tests into multiple suites or suites of suites very easily. So I'm not convinced how well it scales as you write more and more tests. It's also has some limitations if you want to do complex tests on the page (e.g. involving loops or conditions).

So, I very quickly started using Selenium RC (http://www.openqa.org/selenium-rc/) which uses the Selenium engine but lets you write tests in Java (and other languages) using JUnit or similar. This is neat because you can use the usual JUnit things to organise your tests and you have the full power of Java to execute test logic. Selenium is not as good as HTMLUnit at allowing you to get at pieces of your page easily - you quite often need to use the getEval() method to execute JavaScript in the page that extracts what you want and returns it. Currently we have a subclass of the "DefaultSelenium" class into which we're adding lots of helper methods for examining pages.

One other thing is that the "Selenium" object that represents your session is very expensive to create (it requires creating an instance of the web browser). You can use JUnit setUp/tearDown around a suite so that you only create it once (or use @BeforeClass/@AfterClass in Junit 4). However, I've found that with @BeforeClass/@AfterClass you have suite==class and all your tests for the session need to be in one class. I've found that TestNG's concept of a suite is much more suitable as it can span multiple classes and you can its 'groups' concept to run subsets of the tests (http://testng.org/).

Hope that's useful,

Paul

------------------
Paul Field
Global Markets Research IT
Deutsche Bank
---

This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: HTMLUnit & Tapestry 4.1

Posted by Kevin Menard <km...@servprise.com>.
On Mon, 26 Jun 2006 12:17:26 -0400, Jesse Kuhnert <jk...@gmail.com>  
wrote:

> I tried a while back with no luck. It's a very admirable attempt at
> mimicking the browser but not quite complete enough to handle the likes  
> of
> dojo...

Heh, I would be fine with that if the disable JavaScript option actually  
ignored all JavaScript.

> For this type of integration testing I would reccomend using selenium.
> (tacos uses this currently )

That's what I was thinking.  I'll give it a go.  I'm a bit hesitant since  
when I last looked (back in November), the documentation was absolutely  
atrocious.

Thanks,
Kevin

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: HTMLUnit & Tapestry 4.1

Posted by Jesse Kuhnert <jk...@gmail.com>.
I tried a while back with no luck. It's a very admirable attempt at
mimicking the browser but not quite complete enough to handle the likes of
dojo...

For this type of integration testing I would reccomend using selenium.
(tacos uses this currently )

On 6/26/06, Kevin Menard <km...@servprise.com> wrote:
>
> Has anyone here tried to test their Web app with HTMLUnit using Tapestry
> 4.1?  I'm getting a lot of errors related to embedded dojo stuff, even
> with JavaScript disabled in the web client.  Any help would be greatly
> appreciated.
>
> Thanks,
> Kevin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.

Re: HTMLUnit & Tapestry 4.1

Posted by mraible <ma...@raibledesigns.com>.
I was able to fix the problem below by adding an @Shell component to my page.
However, now I'm getting a new issue:

 JavaScript error loading page
http://localhost:9876/appfuse-tapestry-2.0-rc1-SNAPSHOT/signup.html: Wrapped
com.gargoylesoftware.htmlunit.ScriptException: unknown protocol: javascript
(http://localhost:9876/appfuse-tapestry-2.0-rc1-SNAPSHOT/assets/static/dojo-0.4.3/dojo.js#4305)


mraible wrote:
> 
> I tried it with 4.1.3-SNAPSHOT and Canoo WebTest R_1600 (which uses
> HTMLUnit 1.13). Unfortunately it doesn't seem to get past the first page:
> 
> ReferenceError: "dojo" is not defined.
> (http://localhost:9876/appfuse-tapestry-2.0-rc1-SNAPSHOT/assets/static/dojo-0.4.3/dojo3.js#11)
> 
> Matt
> 
> 
> Kalle Korhonen-2 wrote:
>> 
>> Just did. And what do you know; 1.13 does run successfully most of our (
>> http://trailsframework.org) functional tests that broke because of
>> Javascript execution errors when we moved to Tap 4.1.2 (and dojo) and
>> previously run on htmlunit 1.11.
>> 
>> Kalle
>> 
>> 
>> On 8/23/07, mraible <ma...@raibledesigns.com> wrote:
>>>
>>>
>>> Has anyone tried HtmlUnit 1.13 with Tapestry 4.1? They claim much better
>>> JavaScript support in 1.13:
>>>
>>> http://tinyurl.com/2lo6p8
>>>
>>> Matt
>>>
>>>
>>> nirvdrum wrote:
>>> >
>>> > Has anyone here tried to test their Web app with HTMLUnit using
>>> Tapestry
>>> > 4.1?  I'm getting a lot of errors related to embedded dojo stuff, even
>>> > with JavaScript disabled in the web client.  Any help would be greatly
>>> > appreciated.
>>> >
>>> > Thanks,
>>> > Kevin
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> > For additional commands, e-mail: users-help@tapestry.apache.org
>>> >
>>> >
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/HTMLUnit---Tapestry-4.1-tf1849739.html#a12288853
>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/HTMLUnit---Tapestry-4.1-tf1849739.html#a12296648
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: HTMLUnit & Tapestry 4.1

Posted by mraible <ma...@raibledesigns.com>.
I tried it with 4.1.3-SNAPSHOT and Canoo WebTest R_1600 (which uses HTMLUnit
1.13). Unfortunately it doesn't seem to get past the first page:

ReferenceError: "dojo" is not defined.
(http://localhost:9876/appfuse-tapestry-2.0-rc1-SNAPSHOT/assets/static/dojo-0.4.3/dojo3.js#11)

Matt


Kalle Korhonen-2 wrote:
> 
> Just did. And what do you know; 1.13 does run successfully most of our (
> http://trailsframework.org) functional tests that broke because of
> Javascript execution errors when we moved to Tap 4.1.2 (and dojo) and
> previously run on htmlunit 1.11.
> 
> Kalle
> 
> 
> On 8/23/07, mraible <ma...@raibledesigns.com> wrote:
>>
>>
>> Has anyone tried HtmlUnit 1.13 with Tapestry 4.1? They claim much better
>> JavaScript support in 1.13:
>>
>> http://tinyurl.com/2lo6p8
>>
>> Matt
>>
>>
>> nirvdrum wrote:
>> >
>> > Has anyone here tried to test their Web app with HTMLUnit using
>> Tapestry
>> > 4.1?  I'm getting a lot of errors related to embedded dojo stuff, even
>> > with JavaScript disabled in the web client.  Any help would be greatly
>> > appreciated.
>> >
>> > Thanks,
>> > Kevin
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/HTMLUnit---Tapestry-4.1-tf1849739.html#a12288853
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/HTMLUnit---Tapestry-4.1-tf1849739.html#a12295662
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: HTMLUnit & Tapestry 4.1

Posted by Kalle Korhonen <ka...@gmail.com>.
Just did. And what do you know; 1.13 does run successfully most of our (
http://trailsframework.org) functional tests that broke because of
Javascript execution errors when we moved to Tap 4.1.2 (and dojo) and
previously run on htmlunit 1.11.

Kalle


On 8/23/07, mraible <ma...@raibledesigns.com> wrote:
>
>
> Has anyone tried HtmlUnit 1.13 with Tapestry 4.1? They claim much better
> JavaScript support in 1.13:
>
> http://tinyurl.com/2lo6p8
>
> Matt
>
>
> nirvdrum wrote:
> >
> > Has anyone here tried to test their Web app with HTMLUnit using Tapestry
> > 4.1?  I'm getting a lot of errors related to embedded dojo stuff, even
> > with JavaScript disabled in the web client.  Any help would be greatly
> > appreciated.
> >
> > Thanks,
> > Kevin
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/HTMLUnit---Tapestry-4.1-tf1849739.html#a12288853
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: HTMLUnit & Tapestry 4.1

Posted by mraible <ma...@raibledesigns.com>.
Has anyone tried HtmlUnit 1.13 with Tapestry 4.1? They claim much better
JavaScript support in 1.13:

http://tinyurl.com/2lo6p8

Matt


nirvdrum wrote:
> 
> Has anyone here tried to test their Web app with HTMLUnit using Tapestry  
> 4.1?  I'm getting a lot of errors related to embedded dojo stuff, even  
> with JavaScript disabled in the web client.  Any help would be greatly  
> appreciated.
> 
> Thanks,
> Kevin
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/HTMLUnit---Tapestry-4.1-tf1849739.html#a12288853
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org