3 ms·
Automation is Auxiliary – Don’t Rush to Test
- anigbrowl 12y agoShould the feature only cater for the specific example provided? What? No. Examples are by definition a singular instance of a general type. The vast majority of people can infer that since there is a variety of colors, a function that takes a color name as input will have to have handle a variety of color names. The expected behaviour is actually clearer without the examples. I disagree. Without the example, the reader might not know what a HTML color code looks like, or may need a reminder. A non-developer who's overseeing a project may mix it up with something and think of an RGB triple like (255,255,127), or expect a JSON object, or something else. Providing one (or a few) examples make it clear that the HTML color code is in fact a 6-character hexadecimal string.
- captndan 12y agoThanks, 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.