Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

Testing Web 2 cat apps

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


webmaster at cosmicperl

Sep 12, 2009, 10:53 AM

Post #1 of 8 (1684 views)
Permalink
Testing Web 2 cat apps

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 [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


apv at sedition

Sep 12, 2009, 11:01 AM

Post #2 of 8 (1616 views)
Permalink
Re: Testing Web 2 cat apps [In reply to]

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 [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


hoagy at ytfc

Sep 12, 2009, 11:23 AM

Post #3 of 8 (1610 views)
Permalink
Re: Testing Web 2 cat apps [In reply to]

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 [at] lists
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/


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


hutchinson.chris at gmail

Sep 13, 2009, 8:50 PM

Post #4 of 8 (1576 views)
Permalink
Re: Testing Web 2 cat apps [In reply to]

On Sun, Sep 13, 2009 at 4:23 AM, David Stevenson <hoagy [at] ytfc> 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
Attachments: key-server.pl (1.89 KB)


ash_cpan at firemirror

Sep 14, 2009, 1:59 AM

Post #5 of 8 (1577 views)
Permalink
Re: Testing Web 2 cat apps [In reply to]

On Mon, 14 Sep 2009 13:50:51 +1000, Chris <hutchinson.chris [at] gmail>
wrote:
> On Sun, Sep 13, 2009 at 4:23 AM, David Stevenson <hoagy [at] ytfc> 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 [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


hoagy at ytfc

Sep 14, 2009, 2:35 AM

Post #6 of 8 (1565 views)
Permalink
Re: Testing Web 2 cat apps [In reply to]

"CSS accessors are recommended for reasonable speed."

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


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


pagaltzis at gmx

Sep 15, 2009, 9:13 AM

Post #7 of 8 (1561 views)
Permalink
Re: Testing Web 2 cat apps [In reply to]

* David Stevenson <hoagy [at] ytfc> [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 [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


apv at sedition

Sep 15, 2009, 6:28 PM

Post #8 of 8 (1532 views)
Permalink
Re: Re: Testing Web 2 cat apps [In reply to]

On Sep 15, 2009, at 9:13 AM, Aristotle Pagaltzis wrote:
> * David Stevenson <hoagy [at] ytfc> [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 [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.