You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jun Tsai <ju...@gmail.com> on 2005/09/09 04:00:20 UTC

How to write unit test for tapestry 4?

hi,all
How to write unit test for tapestry4?
Thanks.
Jun Tsai

-- 
Welcome to China Java Users Group(CNJUG).
http://cnjug.dev.java.net

Re: How to write unit test for tapestry 4?

Posted by adasal <ad...@gmail.com>.
I think that the grinder httpunit and other functional testing approaches 
are subtly different. We use the grinder, although I haven't, but my 
recollection is that it is more for load testing, rather than coverage.
We use selenium (it has been custom modified) for coverage. It was difficult 
at first because it was not realised that mainly the only way to touch each 
componenet on the page was by introducing xpath, this in turn has meant 
examining each page using firefox's dom inspector, OK once you get into the 
swing of it. There are seperate issues here about unique ids for componants 
or lack of, entailing use of xpath.
Interestingly, junit often has to behave a bit like a functional testing 
client using Tapestry. Here is an example:-
Developing a component modification that entails the use of thread local 
means that the unit test must closely mirror anticipated use by the web 
client. Specifically new server objects should be created to be consumed in 
each test bank, or possibly a new unit test for this purpose.
But we have other cases where using the Creator class would be very useful. 
I haven't done this and would like to learn more as this would be a window 
into the application that might make code modifications and extensions 
easier.
Adam

On 9/9/05, Konstantin Ignatyev <kg...@yahoo.com> wrote:
> 
> The Grinder works perfectly for all kinds of web
> sites, it is not limited to Tapestry.
> 
> Examples are here:
> http://kgionline.com/presentations/wa/readme/tests/technology.html
> 
> Please ignore rest of the materials because they are
> not finalized and have many broken links and errors.
> 
> --- Henri Dupre <he...@gmail.com> wrote:
> 
> > On 9/9/05, Jesse Kuhnert <jk...@gmail.com> wrote:
> > > I haven't used grinder, but I have used httpunit
> > and found it incredibly
> > > painful to get working properly in junit...I'm
> > using testng now but have
> > > since ditched all of that code in favor of
> > tapestrys built-in "Creator"
> > > class.
> >
> > Could you elaborate on this? Is that for Tapestry
> > 4??
> > Could you post one of your component testing
> > example?? I'd really like
> > to do that!
> >
> > Henri.
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > tapestry-user-help@jakarta.apache.org
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

Re: How to write unit test for tapestry 4?

Posted by Konstantin Ignatyev <kg...@yahoo.com>.
The Grinder works perfectly for all kinds of web
sites, it is not limited to Tapestry.

Examples are here:
http://kgionline.com/presentations/wa/readme/tests/technology.html

Please ignore rest of the materials because they are
not finalized and have many broken links and errors.

--- Henri Dupre <he...@gmail.com> wrote:

> On 9/9/05, Jesse Kuhnert <jk...@gmail.com> wrote:
> > I haven't used grinder, but I have used httpunit
> and found it incredibly
> > painful to get working properly in junit...I'm
> using testng now but have
> > since ditched all of that code in favor of
> tapestrys built-in "Creator"
> > class. 
> 
> Could you elaborate on this? Is that for Tapestry
> 4?? 
> Could you post one of your component testing
> example?? I'd really like
> to do that!
> 
> Henri.
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> 
> 


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


Re: How to write unit test for tapestry 4?

Posted by Henri Dupre <he...@gmail.com>.
On 9/9/05, Jesse Kuhnert <jk...@gmail.com> wrote:
> I haven't used grinder, but I have used httpunit and found it incredibly
> painful to get working properly in junit...I'm using testng now but have
> since ditched all of that code in favor of tapestrys built-in "Creator"
> class. 

Could you elaborate on this? Is that for Tapestry 4?? 
Could you post one of your component testing example?? I'd really like
to do that!

Henri.

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


Re: AW: How to write unit test for tapestry 4?

Posted by Kevin Menard <km...@servprise.com>.
On Sep 11, 2005, at 3:52 AM, Ralf E. Stranzenbach wrote:

> I'm strongly interested in examples. I tried to understand examples  
> that
> were delivered with Tapestry 4.0b2 but unfortunately due to my  
> limited time
> I failed in this topic...

Once again, not quite what you're looking for, but I've taken the  
suggestion in the User Guide to use listeners primarily as marshalers  
for delegating to services.  The services are then easily testable.

-- 
Kevin

AW: How to write unit test for tapestry 4?

Posted by "Ralf E. Stranzenbach" <ra...@reswi.de>.
Hi,

besides of testing the application at a whole (based on Grinder or
httpunit), has anyone succeeded check the Pages or Components directly
simulating the request (like StrutsTest) ?

I'm strongly interested in examples. I tried to understand examples that
were delivered with Tapestry 4.0b2 but unfortunately due to my limited time
I failed in this topic...

- Ralf


-----Ursprüngliche Nachricht-----
Von: Marc Tremblay [mailto:marc@pansapien.com] 
Gesendet: Sonntag, 11. September 2005 00:35
An: Tapestry users
Betreff: Re: How to write unit test for tapestry 4?

The Grinder website makes it sound much more for load testing than  
either unit or integration testing.

I think you'll have more luck with something like Selenium (http:// 
selenium.thoughtworks.com/), or Watir (http://wtr.rubyforge.org/) for  
integration testing.

M.

On 9-Sep-05, at 11:54 AM, Jesse Kuhnert wrote:

> I haven't used grinder, but I have used httpunit and found it  
> incredibly
> painful to get working properly in junit...I'm using testng now but  
> have
> since ditched all of that code in favor of tapestrys built-in  
> "Creator"
> class. It lets you call all of the methods on your page/components,  
> which is
> perfect for functional tests..
>
> I don't know what you'd use for integration type tests...Maybe  
> grinder?
>
> On 9/9/05, Konstantin Ignatyev <kg...@yahoo.com> wrote:
>
>>
>> The Grinder - the best tool for the job
>> http://grinder.sourceforge.net/
>>
>> --- Henri Dupre <he...@gmail.com> wrote:
>>
>>
>>> I think Http unit is the best way to go for web page
>>> testing.
>>> I'd be curious to know if there are any ways to test
>>> components.
>>>
>>>
>>> On 9/8/05, Jun Tsai <ju...@gmail.com> wrote:
>>>
>>>> hi,all
>>>> How to write unit test for tapestry4?
>>>> Thanks.
>>>> Jun Tsai
>>>>
>>>> --
>>>> Welcome to China Java Users Group(CNJUG).
>>>> http://cnjug.dev.java.net
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Thanks,
>>>
>>> Henri.
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>>
>>> To unsubscribe, e-mail:
>>> tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail:
>>> tapestry-user-help@jakarta.apache.org
>>>
>>>
>>>
>>
>>
>> Konstantin Ignatyev
>>
>>
>>
>>
>> PS: If this is a typical day on planet earth, humans will add fifteen
>> million tons of carbon to the atmosphere, destroy 115 square miles of
>> tropical rainforest, create seventy-two miles of desert, eliminate  
>> between
>> forty to one hundred species, erode seventy-one million tons of  
>> topsoil, add
>> 2,700 tons of CFCs to the stratosphere, and increase their  
>> population by
>> 263,000
>>
>> Bowers, C.A. The Culture of Denial: Why the Environmental Movement  
>> Needs a
>> Strategy for Reforming Universities and Public Schools. New York:  
>> State
>> University of New York Press, 1997: (4) (5) (p.206)
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user- 
>> help@jakarta.apache.org
>>
>>
>


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



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


Re: How to write unit test for tapestry 4?

Posted by Marc Tremblay <ma...@pansapien.com>.
The Grinder website makes it sound much more for load testing than  
either unit or integration testing.

I think you'll have more luck with something like Selenium (http:// 
selenium.thoughtworks.com/), or Watir (http://wtr.rubyforge.org/) for  
integration testing.

M.

On 9-Sep-05, at 11:54 AM, Jesse Kuhnert wrote:

> I haven't used grinder, but I have used httpunit and found it  
> incredibly
> painful to get working properly in junit...I'm using testng now but  
> have
> since ditched all of that code in favor of tapestrys built-in  
> "Creator"
> class. It lets you call all of the methods on your page/components,  
> which is
> perfect for functional tests..
>
> I don't know what you'd use for integration type tests...Maybe  
> grinder?
>
> On 9/9/05, Konstantin Ignatyev <kg...@yahoo.com> wrote:
>
>>
>> The Grinder - the best tool for the job
>> http://grinder.sourceforge.net/
>>
>> --- Henri Dupre <he...@gmail.com> wrote:
>>
>>
>>> I think Http unit is the best way to go for web page
>>> testing.
>>> I'd be curious to know if there are any ways to test
>>> components.
>>>
>>>
>>> On 9/8/05, Jun Tsai <ju...@gmail.com> wrote:
>>>
>>>> hi,all
>>>> How to write unit test for tapestry4?
>>>> Thanks.
>>>> Jun Tsai
>>>>
>>>> --
>>>> Welcome to China Java Users Group(CNJUG).
>>>> http://cnjug.dev.java.net
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Thanks,
>>>
>>> Henri.
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>>
>>> To unsubscribe, e-mail:
>>> tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail:
>>> tapestry-user-help@jakarta.apache.org
>>>
>>>
>>>
>>
>>
>> Konstantin Ignatyev
>>
>>
>>
>>
>> PS: If this is a typical day on planet earth, humans will add fifteen
>> million tons of carbon to the atmosphere, destroy 115 square miles of
>> tropical rainforest, create seventy-two miles of desert, eliminate  
>> between
>> forty to one hundred species, erode seventy-one million tons of  
>> topsoil, add
>> 2,700 tons of CFCs to the stratosphere, and increase their  
>> population by
>> 263,000
>>
>> Bowers, C.A. The Culture of Denial: Why the Environmental Movement  
>> Needs a
>> Strategy for Reforming Universities and Public Schools. New York:  
>> State
>> University of New York Press, 1997: (4) (5) (p.206)
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user- 
>> help@jakarta.apache.org
>>
>>
>


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


Re: How to write unit test for tapestry 4?

Posted by Jesse Kuhnert <jk...@gmail.com>.
I haven't used grinder, but I have used httpunit and found it incredibly 
painful to get working properly in junit...I'm using testng now but have 
since ditched all of that code in favor of tapestrys built-in "Creator" 
class. It lets you call all of the methods on your page/components, which is 
perfect for functional tests..

I don't know what you'd use for integration type tests...Maybe grinder?

On 9/9/05, Konstantin Ignatyev <kg...@yahoo.com> wrote:
> 
> The Grinder - the best tool for the job
> http://grinder.sourceforge.net/
> 
> --- Henri Dupre <he...@gmail.com> wrote:
> 
> > I think Http unit is the best way to go for web page
> > testing.
> > I'd be curious to know if there are any ways to test
> > components.
> >
> >
> > On 9/8/05, Jun Tsai <ju...@gmail.com> wrote:
> > > hi,all
> > > How to write unit test for tapestry4?
> > > Thanks.
> > > Jun Tsai
> > >
> > > --
> > > Welcome to China Java Users Group(CNJUG).
> > > http://cnjug.dev.java.net
> > >
> > >
> >
> >
> > --
> > Thanks,
> >
> > Henri.
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > tapestry-user-help@jakarta.apache.org
> >
> >
> 
> 
> Konstantin Ignatyev
> 
> 
> 
> 
> PS: If this is a typical day on planet earth, humans will add fifteen 
> million tons of carbon to the atmosphere, destroy 115 square miles of 
> tropical rainforest, create seventy-two miles of desert, eliminate between 
> forty to one hundred species, erode seventy-one million tons of topsoil, add 
> 2,700 tons of CFCs to the stratosphere, and increase their population by 
> 263,000
> 
> Bowers, C.A. The Culture of Denial: Why the Environmental Movement Needs a 
> Strategy for Reforming Universities and Public Schools. New York: State 
> University of New York Press, 1997: (4) (5) (p.206)
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

Re: How to write unit test for tapestry 4?

Posted by Konstantin Ignatyev <kg...@yahoo.com>.
The Grinder - the best tool for the job
http://grinder.sourceforge.net/

--- Henri Dupre <he...@gmail.com> wrote:

> I think Http unit is the best way to go for web page
> testing.
> I'd be curious to know if there are any ways to test
> components.
> 
> 
> On 9/8/05, Jun Tsai <ju...@gmail.com> wrote:
> > hi,all
> > How to write unit test for tapestry4?
> > Thanks.
> > Jun Tsai
> > 
> > --
> > Welcome to China Java Users Group(CNJUG).
> > http://cnjug.dev.java.net
> > 
> > 
> 
> 
> -- 
> Thanks,
> 
> Henri.
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> 
> 


Konstantin Ignatyev




PS: If this is a typical day on planet earth, humans will add fifteen million tons of carbon to the atmosphere, destroy 115 square miles of tropical rainforest, create seventy-two miles of desert, eliminate between forty to one hundred species, erode seventy-one million tons of topsoil, add 2,700 tons of CFCs to the stratosphere, and increase their population by 263,000

Bowers, C.A.  The Culture of Denial:  Why the Environmental Movement Needs a Strategy for Reforming Universities and Public Schools.  New York:  State University of New York Press, 1997: (4) (5) (p.206)

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


Re: How to write unit test for tapestry 4?

Posted by Henri Dupre <he...@gmail.com>.
I think Http unit is the best way to go for web page testing.
I'd be curious to know if there are any ways to test components.


On 9/8/05, Jun Tsai <ju...@gmail.com> wrote:
> hi,all
> How to write unit test for tapestry4?
> Thanks.
> Jun Tsai
> 
> --
> Welcome to China Java Users Group(CNJUG).
> http://cnjug.dev.java.net
> 
> 


-- 
Thanks,

Henri.

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