Defining the API
Conventional Testing Styles
xUnit
xUnit-style syntax typically…
- Uses built-in language constructs for defining “Test Fixtures” (groups of tests) and “Tests”
- Provides
setUp
andtearDown
functions for test setup and cleanup. - Uses “Assertions” implemented as functions accepting 2 parameters: “Expected” and “Actual”
class DogTests {
Dog dog;
SetUp() { dog = new Dog(); }
TestBark() {
AssertEqual("Woof!", dog.Bark());
}
}