Forum: Ruby on Rails Web/HTTP Testing

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B1d59a804bd67487c964bc505a8eb892?d=identicon&s=25 Thiago Arrais (Guest)
on 2006-02-23 18:15
(Received via mailing list)
Hello,

I am looking for a user test automation tool. When I say 'user', I
mean it should mimic the user interacting with the app. That
ultimately boils down to a tool that drives a browser or is able to
make http requests and allow us to deal easily with the responses.

Our requirements are to be able to write the tests in Ruby (no need to
switch to other language for test designing) and (relative)
browser-independence (this one puts Watir out of the game, since it
seems to be IE-dependent for the time being). A nice feature (but not
a must-have) would be possibility of headless (command line)
execution.

I am aware of Selenium and WebUnit. Does anyone have any experience
with either one (or a similar tool)?

Cheers,

Thiago Arrais
1e99128ebac5ca41c91940291d315332?d=identicon&s=25 Luke Redpath (Guest)
on 2006-02-23 20:11
(Received via mailing list)
I  feel Selenium is the way to go. You have a couple of options:

There is the selenium_on_rails plugin:
http://andthennothing.net/archives/2006/02/19/new-...

Lets lets you write the normal, table-based tests using a form of
Markdown, called Selenese, or in Ruby using RSelenese.

There is also:

http://blog.viney.net.nz/articles/2006/02/09/selen...

This uses the normal Ruby Test::Unit infrastructure for writing tests
and loading fixtures.

I had a few problems with the second one, so I use the
selenium_on_rails plugin and it works great.

You can install selenium itself using RubyGems but its an old version,
or download the latest version of Selenium (0.6) and extract into your
vendor directory. Follow the instructions for either of the above.

On 2/23/06, Thiago Arrais <thiago.arrais@gmail.com> wrote:
> seems to be IE-dependent for the time being). A nice feature (but not
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
Cheers,
Luke Redpath
www.lukeredpath.co.uk
D895471fbc8b3b1233a250186d542af8?d=identicon&s=25 Alexey Verkhovsky (alexeyv)
on 2006-02-25 04:54
(Received via mailing list)
Thiago Arrais wrote:

>I am aware of Selenium and WebUnit. Does anyone have any experience
>with either one (or a similar tool)?
>
>
Yes, I've used (and still using) Watir quite extensively for just the
kind of work you describe. It's the best thing since the sliced bread,
as long as you don't have to deal with applets, and can live with your
automated tests working on IE 5.5+ only.

I haven't worked with Selenium, but some fellow ThoughtWorkers say it's
a Good Thing (TM), too. The tradeoff, as far as I understand, is that
with Selenium you have to have some stuff installed on the web server
(deployment is more complicated, therefore), but you can use it on any
OS, with a variety of browsers.

Alexey Verkhovsky
5d15c6821f3c3054c04b85471824ba7c?d=identicon&s=25 Jeff Cohen (Guest)
on 2006-02-25 05:24
(Received via mailing list)
I'll probably sound like a moron here, so bear with me :-)  I don't
understand the interest in these kinds of tools.

Seems to me that decent functional tests are will make sure your actions
are doing what you want them to do.

This is not the first thread I've read that mention the value of
Selenium and Watir, so obviously I'm missing something. Any
enlightenment would be appreciated.

Thanks!
Jeff
D895471fbc8b3b1233a250186d542af8?d=identicon&s=25 Alexey Verkhovsky (alexeyv)
on 2006-02-25 06:06
(Received via mailing list)
Jeff Cohen wrote:

>Seems to me that decent functional tests are will make sure your actions
>are doing what you want them to do.
>
>
Yes, but... When you say "functional", you obviously refer to Rails
controller tests. Well, not everybody (to put it mildly) develops on
Rails. :)

And even with Rails, from a developer's point of view, controller tests
do not cover at least two big things:

1. Javascript.
2. URL parsing/generation

Also, coverage of HTML produced is in practice either non-existant or
patchy (hoe many people actually use XPath assertions against
@response.body?)

Watir is great for testing end-to-end scenarios, where you click through
several screens and there are no 404s or 500s. The #1 reason for adding
Watir test battery to Instiki was that I've had some some fairly heinous
bugs around URL generation, escaping my unit/controller tests.

Ability to do test automation for AJAX should be useful, too.
Disclaimer: I did not personally try testing AJAX calls with Watir on
any industrial scale yet, but I spiked it once and it works.

Best regards,
Alexey Verkhovsky
1e99128ebac5ca41c91940291d315332?d=identicon&s=25 Luke Redpath (Guest)
on 2006-02-25 21:28
(Received via mailing list)
Thats because Rails' idea of "functional" tests aren't really
functional tests, they are more like unit tests for your controllers.
They are great for making sure an action does what it needs to do but
its not very good for testing your app as a whole and making sure your
app is doing what it should, not just the code.

This is where acceptance testing tools like Selenium come in.

Not just that, but clients should be able to write acceptance tests,
not just programmers, as it is your clients who should define what the
acceptance tests are.

Finally, unless you've tested your browser-based app inside a browser,
you haven't really done any proper acceptance testing. Selenium and
Watir let you do that, and they let you automate the process too.

On 25 Feb 2006 04:22:44 -0000, Jeff Cohen
<devlists-rubyonrails@devlists.com> wrote:
> Thanks!
> Jeff
>
>
> --
> Posted with http://DevLists.com.  Sign up and save your time!
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
Cheers,
Luke Redpath
www.lukeredpath.co.uk
This topic is locked and can not be replied to.