Defining the API
Conventional Testing Styles
Behavior-Driven Development
BDD-style syntax typically…
- Places an emphasis on using natural language, e.g.
describe("Dog").it("can bark!") - Provides
beforeandafterfunctions for test setup and cleanup. - Uses natural language for “Expectations”, e.g.
x.ShouldEqual()orExpect(x).toEqual()
Dog dog;
Describe("Dog", () => {
Before(() => { dog = new Dog(); });
It("can bark", () => {
Expect(dog.Bark()).ToEqual("Woof!");
});
});