Reader: Testing Basics
Example reader for the demo course of Brightspacosaurus
1. Learning goals
📄 This reader is a PDF in Brightspace: download reader-testing-basics.pdf. Above is the PDF itself; below is the same text as a web page, easier to read on a phone and to search.
Learning goals:
- Implement a small, well-tested pure function.
- Explain the arrange-act-assert pattern.
A short reference on the arrange-act-assert pattern for unit tests.
2. Arrange-Act-Assert
Most unit tests follow three phases:
- Arrange — set up the object under test and any inputs.
- Act — call the method being tested.
- Assert — verify the result matches expectations.
3. Test flow
4. Class diagram
Keep tests small and focused: one behaviour per test, with a clear name that describes the expected outcome.