Testing in a team¶
Learning objectives
- understand .
For teachers
Prerequisites are:
- Learners have .
Teaching goals are:
- Learners .
Teaching form used:
- .
Lesson plan:
- 5 mins: prior knowledge
- When one works in a team, how to make sure my code keeps doing the same?
-
Test everything? If no, what to test?
-
5 mins: presentation
- 10 mins: demonstration
is_zero
- 25 mins: challenge
- 10 mins: feedback
Tests in a team¶
If all tests pass, we are -by definition- happy.
Programming team tresinformal
Problem¶
Q: When one works in a team, how to make sure my code keeps doing the same?
. . .
A: Apply the Beyoncé Rule
Beyoncé rule¶
'If you like it, then you gotta put a test on it'
Teams should be reluctant to change tests: this will likely break other code.
Source: Wikimedia
Untestable functions¶
Q: How to test this function?
. . .
A: Never write untestable functions
Making untestable functions testable¶
Q: How to make this function testable?
. . .
Testing graphical functions¶
Q: How to test this function thoroughly:
- Plot looks pretty
- Colors are correct
- Trend line is drawn
. . .
A: usually: use a human, e.g. a code reviewer
In most cases, graphical analysis tools and/or AI are overkill. If you are stubborn: try!