3 ms·
Thanks, one of the problems of blogging alone is the lack of cognitive diversity that you can enjoy through conversation as a group! I agree that a "When" requ
by captndan 12y ago
Thanks, one of the problems of blogging alone is the lack of cognitive diversity that you can enjoy through conversation as a group!
I agree that a "When" requesting an HTML colour code followed by a "Then" also referring to an "HTML colour code" is rather tautological.
Given the name of a colour
When I request the HTML colour code
Then I should receive the distinct 6-character hexademical string representing the colour provided
That seems closer to the correct behavioural description than what's on the blog.
I don't intend to suggest that examples should not be discussed or included, but that sticking rigidly to the syntax expected by Cucumber results in scenarios that aren't as accessible as they could be.
Prior to automated testing, in situations such as this where examples would aid understanding, I would encourage documenting a high level scenario as above, and then subsequent scenarios describing potential examples, before I'd suggest moving to the scenario outline syntax.
For example:
Scenario: Retrieving a colour code by name
Given the name of a colour
When I request the HTML colour code
Then I should receive the distinct 6-character hexademical string representing the colour provided
Scenario: Retrieving a colour code for 'Red'
Given the colour name 'Red'
When I request the HTML colour code
Then I should receive 'FF0000'
What do you reckon?
- captndan 12y agoI worry that the example of HTML colour codes implies that the client is more technically minded than the article was trying to claim. Updated article with new scenarios in an attempt to convey original point better!
- anigbrowl 12y agoGood stuff. I think the basic point is a good one, it just needed some fine-tuning.