[Rspec-users] domain language?

aslak hellesoy aslak.hellesoy at gmail.com
Mon Oct 30 18:57:01 EST 2006

On 10/30/06, Phlip <phlip2005 at gmail.com> wrote:
> RSpeckers:
> I went with RSpec instead of Systir because I downloaded and installed
> the former first.
> (I know that's not exactly a ringing endorsement! ;-)

maybe not, but it's a start :-) And systir doesn't have a gem, which
might have put you off, I don't know.

I have to admit I don't understand what problem systir attempts to
solve though....

> I want to compete with FIT and Fitnesse, like this:
> http://www.zeroplayer.com/cgi-bin/wiki?TestFlea#tropism
> (Click on a Green Bar to distend one test case.)
> I want a domain-specific language in the parchment-colored area on the right.
> I don't want to invent it the bass-ackwards way FIT does, with its
> Java-style Action Fixture. That just gets me back to writing each line
> as a custom function. Ruby solutions tend to be much more elegant than
> that!

Personally I'm a big fan of FIT. I like the way it allows business
rules to be expressed at a very high level.

Browser testing tools like Watir and Selenium-RC are good too, but I
tend to prefer a UI agnostic framework for most of the business logic
and only use Watir/Selenium-RC to verify navigation.

> Now here's my RSpec_Watir solution, to log into a site:
> snapshot()
> @browser.should_contain("login")
> @browser.text_field(:id, 'login').should_exist
> @browser.ie.document.activeElement.name.should_equal('login')
> # .because login field should have the focus

Have you looked at RSpec's vendor/watir directory? (Only available if
you check out the code from svn - it's not in the gem yet).

> Those lines violate the Systir principles; they use parens () and
> variables and state. They use a comment instead of an assertion
> documentation string.
> RSpec has gone a long way towards producing readable sentences -
> "should_contain" instead of "assert ... contains?" etc.
> How to go the extra step? How to improve my RSpec style? How to get
> rid of @browser, and have a true domain language, without writing a
> private function for every stinkin' operation on my website?

Wouldn't systir also require you to define higher wrapper methods?

> Oh, and soon my tests must use 2 or more browsers, too...

Selenium-RC can do that. See RSpec's vendor/selenium for an example.


> (I suspect I can't just cram in Systir, because it has a competing
> test runner. And I have a bug report on ZenTest that I don't want to
> work around yet.)
> --
>   Phlip
>   http://c2.com/cgi/wiki?ZeekLand  <-- NOT a blog!!
> _______________________________________________
> Rspec-users mailing list
> Rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the Rspec-users mailing list