Testing Web 2 cat apps

View: New views
8 Messages — Rating Filter:   Alert me  

Testing Web 2 cat apps

by CosmicPerl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi All,
  So far all the Catalyst testing I've done has been with WWW::Mechanize.

I'm just writing tests for a Catalyst component I've written that only
produces one TT view, everything else is done with JQuery/AJAX/JSON. It
would be nice to test all the JQuery from the Perl test suite... But how?

If there isn't a good way to do it from the Perl tests, then what is the
strategy for automated testing of JQuery code in Catalyst apps?


Lyle


_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: Testing Web 2 cat apps

by Ashley Pond V :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sep 12, 2009, at 10:53 AM, Lyle wrote:

> Hi All,
>  So far all the Catalyst testing I've done has been with  
> WWW::Mechanize.
>
> I'm just writing tests for a Catalyst component I've written that  
> only produces one TT view, everything else is done with JQuery/AJAX/
> JSON. It would be nice to test all the JQuery from the Perl test  
> suite... But how?
>
> If there isn't a good way to do it from the Perl tests, then what  
> is the strategy for automated testing of JQuery code in Catalyst apps?

Selenium + Perl. It executes the tests within a running browser.  
Requires Java to run the browser controller (the Selenium server).  
There is a sweet IDE plugin for Firefox for writing the tests. Google  
around for it. There are many examples, docs, and supporting modules.

http://search.cpan.org/search?query=selenium&mode=all

-Ashley

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: Testing Web 2 cat apps

by David Stevenson-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I second the recommendation of Selenium.  Even with the IDE it can  
take a while to get tests together, but it's well worth it IME.


On 12 Sep 2009, at 19:01, Ashley wrote:

> On Sep 12, 2009, at 10:53 AM, Lyle wrote:
>> Hi All,
>> So far all the Catalyst testing I've done has been with  
>> WWW::Mechanize.
>>
>> I'm just writing tests for a Catalyst component I've written that  
>> only produces one TT view, everything else is done with JQuery/AJAX/
>> JSON. It would be nice to test all the JQuery from the Perl test  
>> suite... But how?
>>
>> If there isn't a good way to do it from the Perl tests, then what  
>> is the strategy for automated testing of JQuery code in Catalyst  
>> apps?
>
> Selenium + Perl. It executes the tests within a running browser.  
> Requires Java to run the browser controller (the Selenium server).  
> There is a sweet IDE plugin for Firefox for writing the tests.  
> Google around for it. There are many examples, docs, and supporting  
> modules.
>
> http://search.cpan.org/search?query=selenium&mode=all
>
> -Ashley
>
> _______________________________________________
> List: Catalyst@...
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@.../
> Dev site: http://dev.catalyst.perl.org/


_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: Testing Web 2 cat apps

by Chris-230 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, Sep 13, 2009 at 4:23 AM, David Stevenson <hoagy@...> wrote:
> I second the recommendation of Selenium.  Even with the IDE it can take a
> while to get tests together, but it's well worth it IME.
>

Well worth it, but running selenium tests against IE using DOM
accessors (div[2]/table[2]/tr[1]/td[2]) can be painfully slow. CSS
accessors are recommended for reasonable speed.

If you need to test file upload/downloads, then a daemon based on
Win32::GuiTest is handy to type filenames into browser file dialogs
(can't be done from javascript). I've attached one we use in our
vmware windows selenium snapshot.

- Chris


_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

key-server.pl (2K) Download Attachment

Re: Testing Web 2 cat apps

by Ash Berlin-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Mon, 14 Sep 2009 13:50:51 +1000, Chris <hutchinson.chris@...>
wrote:

> On Sun, Sep 13, 2009 at 4:23 AM, David Stevenson <hoagy@...> wrote:
>> I second the recommendation of Selenium.  Even with the IDE it can take
> a
>> while to get tests together, but it's well worth it IME.
>>
>
> Well worth it, but running selenium tests against IE using DOM
> accessors (div[2]/table[2]/tr[1]/td[2]) can be painfully slow. CSS
> accessors are recommended for reasonable speed.
>
> If you need to test file upload/downloads, then a daemon based on
> Win32::GuiTest is handy to type filenames into browser file dialogs
> (can't be done from javascript). I've attached one we use in our
> vmware windows selenium snapshot.
>
> - Chris

Good to know that there's an option for IE + Sel + file uploads. On the
firefox front, it is possible if you get selenium to launch FF right
(google for the particular invocation.) Then you just put a filename in the
box like its a text input, and FF will submit the file for you - all via
javascript.


_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: Testing Web 2 cat apps

by David Stevenson-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

"CSS accessors are recommended for reasonable speed."

And they tend to be more robust to page layout changes, compared to  
XPath.


_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: Testing Web 2 cat apps

by Aristotle Pagaltzis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

* David Stevenson <hoagy@...> [2009-09-14 11:40]:
> "CSS accessors are recommended for reasonable speed."
>
> And they tend to be more robust to page layout changes,
> compared to XPath.

That doesn’t make any sense. Any CSS selector has a directly
equivalent XPath expression.

http://plasmasturm.org/log/444/

Whether XPath is more or less robust depends only on whether
you write it to be.

Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: Re: Testing Web 2 cat apps

by Ashley Pond V :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sep 15, 2009, at 9:13 AM, Aristotle Pagaltzis wrote:

> * David Stevenson <hoagy@...> [2009-09-14 11:40]:
>> "CSS accessors are recommended for reasonable speed."
>>
>> And they tend to be more robust to page layout changes,
>> compared to XPath.
>
> That doesn’t make any sense. Any CSS selector has a directly
> equivalent XPath expression.
>
> http://plasmasturm.org/log/444/
>
> Whether XPath is more or less robust depends only on whether
> you write it to be.


And this (I don't think Aristotle mentions in his post) is really cool:
    http://search.cpan.org/perldoc?HTML::Selector::XPath


_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/