Painless iOS Testing With Cucumber
testingwithfrank.com
testingwithfrank.com
Yes, I've heard of those mythical teams that are rumoured to let their project managers/customers/users write acceptance tests, but I've never actually seen one.
I just find it a bit odd that developers would choose to abstract their tests behind a prose based lookup table. Maybe someone can enlighten me?
Here's a sample:
Feature: Manage Credentials
Background:
Given I am signed in as a superuser
And there are 3 credentials
Scenario: Listing Credentials
When I view the list of credentials
Then I should see all 3 credentials in the list
When I add a 4th credential
And I view the list of credentials
Then I should see all 4 credentials in the list
When I change the name of the 1st credential
And I view the list of credentials
Then I should see that the 1st credential's name has been changed
When I delete the 2nd credential
Then I should see all credentials except the deleted oneI wouldn't let a customer write acceptance tests in a vacum, in fact we typically recommend the acceptance tests we think are adequate and they sign off usually with modifications.
As a side note, I'm experimenting with RubyMotion and I really like the rspec clone built in, it would be especially nice to use cucumber with it as well though.
If you use a descriptive style "spec" testing framework, the output can be similar "A banana should always ...", "A banana when given to a customer should ..." which is just as readable.
I have programming students who have difficulty at writing integration tests, much let alone their future customers. If a customer was to try to write a cucumber test for themselves you would surely have to modify it to make it work correctly right?
This is the only argument i've heard for this style of natural language testing, and i've never heard it from a customer. I've never heard a contractors client come running in from the wings yelling "WE LOVE CUCUMBER, AND COULDN'T LIVE WITHOUT IT!!". I would be interested to hear their point of view.
Sorry to troll on cucumber, I think easier iOS testing and more iOS testing is only a good thing. I'm just personally not a fan of this style tests. Been there done that, now I write my tests in the same language that i'm coding in.
I found that Calabash does almost the same thing as Frank and has support for more mobile phones http://blog.lesspainful.com/
Non-developer people aren't stupid, they just need a little help to understand. Cucumber lets them be valuable contributors instead of someone to grapple with over acceptance testing.
Cucumber has another fantastic use, human readable, computer executable tests which are great if you work in enterprise environments where you have human test teams / client human test teams etc.
The usual situation is they have some crappy "test" spreadsheet or (if we are lucky) proprietary systems of various quality.
Using cucumber the test teams can create tests that they can read and test manually but ALSO allows us to test automatically as well.
(Note: In this scenario the much maligned imperative style and web_steps.rb are also very useful since they remove ambiguity)