You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Kai Weber <ka...@glorybox.de> on 2009/06/23 00:19:27 UTC
Best practice unit testing pages and components
How would I test a page or a component when a @Parameter is not
accessible because of its need to be a private variable?
I want to test my pages and components with unit tests as I do with my
service classes.
Regards, Kai
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Best practice unit testing pages and components
Posted by Paul Field <pa...@db.com>.
Hi Kai,
> > How would I test a page or a component when a @Parameter is not
accessible
> > because of its need to be a private variable?
As well as tests directly on the page/component object that you can do
with Tapestry's TestBase class, you can also write tests that run a page
through one or more requests and where you test the rendered output. You
can test components by embedding them into a "demo" page and writing tests
against that.
See:
http://tapestry.apache.org/tapestry5.1/guide/unit-testing-pages.html
If you start on this route then you'll want to use the Testify library to
help you:
http://tapestry.formos.com/nightly/tapestry-testify/
And you'll find the XPath library useful for asserting things about parts
of the output:
http://tapestry.formos.com/nightly/tapestry-xpath/
Best wishes,
Paul
------------------
Paul Field
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 delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures.
Re: Best practice unit testing pages and components
Posted by Igor Drobiazko <ig...@gmail.com>.
Take a look into this class:
http://tapestry.apache.org/tapestry5.1/apidocs/org/apache/tapestry5/ioc/test/TestBase.html
The methods create, get and set are useful in tests.
On Tue, Jun 23, 2009 at 12:19 AM, Kai Weber <ka...@glorybox.de> wrote:
> How would I test a page or a component when a @Parameter is not accessible
> because of its need to be a private variable?
>
> I want to test my pages and components with unit tests as I do with my
> service classes.
>
> Regards, Kai
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Best regards,
Igor Drobiazko
Re: Best practice unit testing pages and components
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Mon, 22 Jun 2009 19:19:27 -0300, Kai Weber <ka...@glorybox.de>
escreveu:
> How would I test a page or a component when a @Parameter is not
> accessible because of its need to be a private variable?
If the component is written by you, add a getter and a setter, probably
with package visibility.
--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org