Why Jasmine is called a "BDD" testing framework even if no "Given/When/Then" supported?
Jasmine does not prevent you from using given-when-then, below is an example showing two ways you could use given-when-then whilst using Jasmine.
describe("Given a string containing 'foo'", function(){
var someString;
beforeEach(function() {
someString = "foo";
});
describe("When I append 'bar'", function(){
beforeEach(function() {
someString += "bar";
});
it("Then the string is 'foobar'", function(){
expect(someString).toBe("foobar");
});
});
it("When I append 'baz' Then the string is 'foobaz'", function(){
someString += "baz";
expect(someString).toBe("foobaz");
});
});
Find a style that works for you. You should ensure that the test description describes effectively what you are testing. You can use the given-when-then style sentence as a tool to ensure that your test description is precise about what is being tested.
I'd describe Jasmine as a unit testing framework for javascript that has alot of syntactic sugar so that we can write our 'tests' more as specifications that describe behaviour. Mostly we use Given, When, Then when we are describing/specifying the overall behaviour of a system in the language of the business. When you are describing a component of a system, using natural language generally has fewer benefits - the greater detail required at lower levels of abstraction is better supported by a programming language.
Now unit testing is a fundamental part of BDD, and jasmine supports this in a way that allows us to specify behaviour fairly eloquently, so yes it can definitely be a BDD testing tool/framework even if it only targets lower levels of abstraction.
Cucumber only targets higher levels of abstraction. The fact that its pants at writing low level specifications doesn't make it any less a BDD testing framework (BDD collaboration tool).
An interesting point is that to do BDD you really need two different testing tools, one to do the high level abstraction stuff, and another to do the lower level detailed specification stuff. Different tools for different tasks that are both part of the same process.
Finally GWT really is just an implementation detail of scenario writing. Its a way of differentiating
- setting up state G
- describing an action W
- examining the consequences of the action T