I like the Jasmine Jasmine BDD tool, as it is very flexible to define stories. Jasmine stories can be structured so that preliminary stories run before stories that are dependent on previous ones. This makes the testing code very readable and readable.
Code Reuse Example:
describe("parent story", function() { var a = 1; beforeEach(function(){ a++; }); it("should equal to 2", function() { expect(a).toBe(2); }); describe("child story"), function(){ beforeEach(function(){ a++; }); it("should equal to 3", function(){ expect(a).toBe(3); }); }); });
I did some research on using this concept in the Java world and found that the most popular BDD in Java is JBehave. However, it does not seem to be as flexible as Jasmine in terms of reusing the testing code in previous stories for children's stories. I could not figure out how this could pass reusable variables to child stories from the parent, like the Jasmine example.
JBehave has a Concept Concept that runs before others, however I could not find how the state created in DataStories can be conveyed to those that depend on them.
Can JBehave do this job as well as Jasmine? If not, is there another BDD environment in Java that can do the same?
source share