Testify cannot run unit tests that rely on javascript - it is not 
simulating an entire browser. So your tests act more like a browser 
running with javascript turned off and you can't test AJAX functionality. 
However you can test that your page degrades well if there is no 
Javascript :-)

You can find out a bit more about making your pages degrade gracefully in 
Tapestry's Ajax guide:
http://tapestry.apache.org/tapestry5/guide/ajax.html
(look for the section "Graceful Degradation")

If you need a full browser simulation, then try using Selenium with the 
tapestry-test module (http://tapestry.apache.org/tapestry5/tapestry-test/)

Selenium is a lot slower than Testify though, so the best approach is to 
use both tools and test with Testify for non-Javascript/Ajax functionality 
and use Selenium when you want to test with a full browser implementation.

- Paul


joknroll <adjudentifr...@yahoo.com> wrote on 07/04/2011 13:16:02:

> hum, I agree with you,it works :)
> But my problem concern the usage of tapestry testify to do unit testing 
on
> my component.
> 
> My dummy case is to understand the behavior of unit test with testify to
> implement it in a bigger project.
> 
> --------------------------------------------------------
> my dummy.tml:
> <?xml version="1.0" encoding="UTF-8"?>
> 
> 
> ${messageChangeWhenSubmit}
> 
> 
> 
> 
> 
> 
> 
> 
> --------------------------------------------------------
> in my class TestDummy.java:
> [...]
>    @Test
>    public void updateValue() {
>       Document doc = tester.renderPage("demo/dummyDemo");
>       Element submitButton = doc.getElementById("mySubmit");
>       Map&lt;String, String&gt; parameters = new HashMap&lt;String,
> String&gt;();
>       doc = tester.clickSubmit(submitButton, parameters);
>       assertEquals(doc.getElementById("testDiv").getChildMarkup(), "!! 
UPDATE
> !!");
>    }
> --------------------------------------------------------
> in my Dummy.java
> [...]
>    @Persist
>    @Property
>    private String messageChangeWhenSubmit;
> 
>    @Component(id = "myForm")
>    private Form myForm;
> 
>    @Property
>    @InjectComponent
>    private Zone myZone;
> 
>    @SetupRender
>    public void init() {
>       logger.debug("## INIT ##");
>       messageChangeWhenSubmit = "somethingToTest";
>    }
> 
>    @OnEvent(value = EventConstants.VALIDATE, component = "myForm")
>    public Object launchProcess() {
>       messageChangeWhenSubmit = "!! UPDATE !!";
>       return myZone;
>    }
> --------------------------------------------------------
> 
> The test "updateValue" failed.. I wanted to know if it's a usage of 
testify
> and what I have to be aware of to pass the test....
> 
> --
> View this message in context: http://tapestry.1045711.n5.nabble.
> com/Tapestry-Testify-SetupRender-launched-instead-of-update-a-zone-
> tp4288081p4288382.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 



---

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.

Reply via email to