Friday, February 12, 2010

RSpec, should and Watir; what was the point again?

In the Watir group, I read this post about using RSpec with Watir and it still doesn't make sense to me why someone would want to use RSpec with Watir. The long and short of the thread was that someone was unclear on the syntax of RSpec
questionframe.radio(:id, "rlbYesNo_0").checked? should be_true
vs
questionframe.radio(:id, "rlbYesNo_0").checked?.should be_true

Later, others discussed the proper syntax of matchers in other veins as well, the idea of writing your own matchers, and someone brought up later that a fix had been added to RSpec because it and Watir were not playing together exactly right. http://groups.google.com/group/watir-general/browse_thread/thread/f7b72bf1742d8895

The confusion displayed, potential for incorrect syntax, time spent learning/discussing, and fact that you're introducing another layer of someone else's code to test for you which may itself contain bugs are good enough reasons for me not to use RSpec (keep reading).

I don't believe
x.should have_something

is that much clearer than
assert(x.has_something?)

I believe the more code between (the meat of) your testcase and the app under test, the more likely you are to introduce bugs (yours or someone else's) and the more time you have to spend testing your test code.

I almost wrote this post asking "why use RSpec at all?" but after looking at RSpec's homepage again I was reminded what it's real purpose is: BDD (no screwing around for reals BDD). I think that's what doesn't jive with Watir. I don't think Watir would be a great tool for BDD in most cases. I think of Watir as a GUI test tool and (if you're writing very specific, potentially lengthy tests) an end-to-end test tool. Also it's just slow. If you're doing serious BDD you need your tests to run fast and preferrably test the minimal set of your code as possible. Watir is too slow and just does too much for that.

RSpec is "pretty" in that it's almost painfully obvious (which I appreciate, I try to write obvious code), but I don't think that's the end it's trying to reach. It's real end is trying to facilitate BDD.

Monday, February 1, 2010

mic check 1, 2, 4

hello blogging world!

let's see how this thing handles...

tiny
big


bold
ital
georgiacourier
times

here's a link to google

linked centered img:
ugh. why put that at the top of the page?

ok be that way, i'll reformat it myself.