2009/9/18 Stuart Guthrie <[email protected]>:
> Hi there,
>
> If you're not a developer, you can ignore the rest of this post...
>
> Just wondering what people are using for integration testing their
> applications (should they write them).
>
> We're evaluating tellurium (groovy-based) which is another base-metal like
> sellenium (used by a lot of places).
>
> We currently use Selenium, our issues are that it doesn't handle complex
> javascript interactions with any degree of grace. Particularly the dojo
> toolkit that we use.
>
> I've also heard windmill is good if you're a python-leaning developer.
>
> Any experience out there with writing complex tests on top of javascript web
> UI applications? I'd love to know where others have trod.

If you don't mind using Ruby, you might want to have a look at
Cucumber[0] with Webrat[1].

You use Cucumber to write an executable specification, and behind the
scenes use Webrat to interact with the system you're testing.

Here's an example Cucumber feature:

Feature: Login
  To ensure the safety of the application
  A regular user of the system
  Must authenticate before using the app

  Scenario: Successful login
    Given I am not authenticated
    When I go to /
    And I fill in "email" with "[email protected]"
    And I fill in "password" with "test"
    And I press "Log in"
    Then I should see "Logged in successfully"

The steps within the scenario get mapped to a Ruby DSL behind the
scenes, so the "When I go to /" step gets mapped to:

When /^I go to (.*)$/ do |path|
  visit(path)
end

The regex capture gets mapped to the path variable, and is passed to
the visit method, which is provided by Webrat. Webrat can interact
with sites with a bunch of different backends (Selenium, Watir,
Mechanize, Rails), so you can swap out the underlying testing
infrastructure without rewriting your high-level specifications.

Probably the coolest thing is that you can reuse those Cucumber steps
in any of your Cucumber features, which eliminates a lot of
duplication and brittleness in your tests.

Some of the Cucumber + Webrat documentation can be a bit Rails
specific, but the Selenium documentation is pretty solid. [2][3]

I've heard good things about Watir also, and the documentation has a
bunch of examples[4] for interacting with Gmail + Gmaps, so I assume
it handles complex JS pretty well.

I use Cucumber + Webrat on pretty much every web project I hack on,
but I don't test my JavaScript, mainly because I use progressive
enhancement. That said, there are a *lot* of people in the Ruby
community doing testing with Cucumber + Webrat + Selenium, so they
can't all be wrong.

HTH,
Lindsay


[0] http://cukes.info/
[1] http://wiki.github.com/brynary/webrat
[2] http://wiki.github.com/aslakhellesoy/cucumber/setting-up-selenium
[3] http://wiki.github.com/brynary/webrat/selenium
[4] http://wiki.openqa.org/display/WTR/Examples

-- 
http://holmwood.id.au/~lindsay/ (me)
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to