Steak 1.0 released or Why Cucumber might not be your best choice
groups.google.com
groups.google.com
However, two weeks ago, I removed Steak entirely, and am now using pure RSpec for my integration tests.
If you look at the heart of Steak [1] you'll see it's nothing more than a couple aliases for existing RSpec methods. 'example' becomes 'scenario', and 'before' becomes 'background'. I'm all for accurate language, but I don't think switching a couple method names really changes anything important here.
Switching from Steak to pure RSpec was simply a matter of a global search and replace, and now I've got one less gem to think about.
[1] https://github.com/cavalle/steak/blob/master/lib/rspec-2/ste...
So using this definition, you're still kind of using Steak =;-) (and actually is what made you do that step).
I think it provides that value, but you can cook it on your own because as you point is not difficult at all.
Otherwise, we've just been using Test::Unit or straight RSpec with webrat/capybara.
The second definition exceeded my jargon quota for the day:
BDD is a second-generation, outside-in, pull-based, multiple-stakeholder, multiple-scale, high-automation, agile methodology. It describes a cycle of interactions with well-defined outputs, resulting in the delivery of working, tested software that matters.
There is no significant difference between BDD and TDD other than that terminology, and most leading BDD proponents in the ruby community will refuse to set it in opposition with TDD. BDD is just a form of TDD, not some separate discipline. Defining BDD without mentioning its relationship to TDD is stupid.
TDD means testing that you've implemented a system which has all the significant qualities you expected. It intends to prove that the system does all of the right things and none of the wrong things on the way to delivering what the customer asked for. This is more like the blueprint of the building, making all significant details explicit.
You could practice BDD without TDD, though I've yet to see someone choose to. You can practice TDD without BDD, which I've seen many people do.
No, that's "Acceptance testing", and doing it without TDD is actually quite common.
RSpec itself is in fact driven by the BDD ideas - adapting the language to make "doing the right thing" easier, and focusing on testing behaviour rather than state. RSpec has little or nothing to do with acceptance testing. It is thoroughly a unit testing tool.
That's not the point, at least as far as I'm concerned. The point is to make me, as a developer, think like a user and write the specification of a feature from a user's perspective.
So instead of writing 'page.should have_css(...),' I write "Then I should see ...", and specify the details of that somewhere else. Yes, I could just write a method 'def i_should_see,' but I'm a developer, and hence lazy and also comfortable with the detail. That means I'm more than likely not to do that, but then I've got a spec which doesn't express the feature from the user's point of view.
I'm prepared to accept that there are developers who are disciplined enough to write specs with Steak which do express things from the user's point of view, but I'm certainly not one of them.
This also means that the tests can be abstracted where appropriate, using the full power of ruby's syntax. I haven't missed Cucumber since switching to Steak.
one of the things I like a lot about Cucumber is having precise definition of stories in a way that I can discuss with actual users. in a Steak world, what mechanisms get used for that?
However, the idea of Steak on projects where I'm the stakeholder, or only developers are working on a team, seems like a nice idea because it is less maintenance.
[which isn't to downplay the value of tests, those are important too, and I could see Steak potentially adding value on that front]
If steak becomes the meme of the day, at least it isn't actively harmful like cucumber was.
visit "/special_recipes/new"
fill_in "special_recipe[name]", :with => "Pie"
select "Test User", :from => "special_recipe[user_id]"
click_button "Create Special Recipe"
The mind naturally skips the punctuation. It actually reads easier than some Cucumber tests I've seen."actively harmful like cucumber was"
I think you should provide some basis for that. Some examples of how you think cucumber is harmful.
Great expense, little gain -> actively harmful to projects.
You end up spending lots of "testing time" fiddling with cucumber stuff. It feels productive, but you'd have more, better tests writing straight into webrat
Bingo!!!
I'll stick to cucumber. English matters in acceptance testing.
Last time I checked cucumber was the equivalent of inventing an additional, imaginary stakeholder for every story. A stakeholder who recently immigrated from a distant country and insists on having each and every spec laboriously translated to his unusual and very limited dialect of english, before anyone is allowed to proceed.
I'm all for imaginary friends, but I really think you should refrain from bringing them to the office if you value your productivity.
[edit:] Yeah vote me down, in your tight jeans and your vintage glasses! ;)