FIT4004 Lecture Notes - Lecture 8: Unit Testing, List Of Unit Testing Frameworks
Week 8 - Unit testing
Why unit test?
●Easiest to find problems in isolation. By testing the smallest chunks of code at a
time, it’s easier to find out what’s causing the problem
How to do unit tests?
Refer to course notes [Unit testing] under week 8
What makes a good unit/test suite?
●A way of determining how good your test suite is, is to use coverage tools (Refer
to course notes [Unit testing] under week 8)
Stubs were empty methods (or functions) that did nothing but return appropriate
dummy data.
Fakes are more comprehensive but limited prototype implementations for testing that
can do things like check arguments and apply simple logic to determine an appropriate
test data.
Shims were intermediate code inserted to check arguments before handing off to the
real external code that did the work.
Drivers were used to drive units for testing purposes; their job is now done by the test
methods you write for PyUnit.
Mocks are dummy objects that allow you to mimic external dependencies and to check
how they've been accessed.
Document Summary
By testing the smallest chunks of code at a time, it"s easier to find out what"s causing the problem. Refer to course notes [unit testing] under week 8. A way of determining how good your test suite is, is to use coverage tools ( refer to course notes [unit testing] under week 8) Stubs were empty methods (or functions) that did nothing but return appropriate dummy data. Fakes are more comprehensive but limited prototype implementations for testing that can do things like check arguments and apply simple logic to determine an appropriate test data. Were intermediate code inserted to check arguments before handing off to the. Shims real external code that did the work. Were used to drive units for testing purposes; their job is now done by the test.