Don't understand this Gherkin scenario


#1

This scenario doesn’t end with a Then, so I don’t understand what this is actually doing. If someone read this out loud to me, I would respond “and then…?” :wink:


#2

Haha, good point. This is a type. The last step should say Then

interestingly, in Cucumber any step definition is a step, no matter of the prefix.


#3

Ah ok, so it should say Then. :slight_smile: You’re right, I noticed that it doesn’t seem to matter what the actual text is, every step gets executed in the same manner apparently. So it’s just written in plain English to make it more readable.


#4

One more question:

If I can use Cucumber to test various processes of my app, why would I need Jasmine?

A tiny backstory: though I’ve been coding for nearly 20 years, I took a bit of a break for several years and I missed out on the whole BDD/TDD thing. I actually am just learning it now. I figured it would be irresponsible not to learn and implement unit testing in my projects, going forward.


#5

Sure.

Cucumber is used for making specifications executable. So you typically use end to end tests to do this.

Unit tests are for lower level testing like permutations and algorithms.

I cover all of this in the first few chapters of the book.

Sam


#6

Makes sense - so Jasmine is more for the guts of the app it seems, while Cucumber is more for what the user experiences. I’ll dig into those chapters again. Thanks for all the help!


#7

No problem, this article may also help you

http://themobilesurge.com/post/103567014975/bddcucumber-basics-make-your-business-rules

Be sure to read the responses in the comments too, especially from Aslak (author of the original Cucumber)