Closed ghost closed 8 years ago
You're free to use whatever assertion library you want with Yadda, just import and go. As to why you should consider yadda instead of cucumber-js, the following was my reasoning 2.5 years ago. I haven't checked back to see whether it has improved since.
http://blog.acuminous.co.uk/2013/05/do-you-like-your-bdd-full-fat-skimmed.html
My problem with CucumberJS is that the Gerkin syntax is restrictive. I don't want to be limited to starting my sentences with Given, When, Then, And and But. I want to express myself naturally. I also want a test runner makes good decisions about which steps to run, instead of picking the first matching one it comes to. I want a tool that doesn't fail silently. I want a tool that I can use synchronously or asynchronously. I want a tool that lets me plugin different step libraries so that I can test multiple interfaces (e.g. rest and HTML) with the same scenarios. I even want a tool that has nothing to do with testing and just maps ordinary sentences to functions so I could use it in a rules engine or build script. That's why I wrote Yadda.
@cressie176 These are good points. :-) Is it possible to use the jasmine expect()
function with yadda? If not, then what part of jasmine is used by the jasmine plugin? According to the example nothing, or it is not obvious.
Jasmine is the test runner. https://github.com/acuminous/yadda/blob/master/examples/jasmine/bin/example.sh#L3
And the reporter https://github.com/acuminous/yadda/blob/master/examples/jasmine/spec/bottles-spec.js#L5-L6
By running Jasmine you add describe
and it
functions to global scope. The plugin adds feature
, scenario
and step
functions, which call describe
and it
with text from your feature files.
WRT to expect() I would just give it a go. If it doesn't work then import chai expect and use the language chains from there.
@cressie176 Thanks!
I checked your jasmine example: https://github.com/acuminous/yadda/blob/master/examples/jasmine/bottles-library.js#L29
What I expected is:
expect(number_of_bottles).toEqual(wall.bottles);
, but what I got isassert.equal(number_of_bottles, wall.bottles);
. Can you explain why does it worth to use yadda instead of cucumber-js, if I cannot use jasmine assertions in the step definitions?