Manual vs Automated Testing
Empirical
Testing Model (pdf)
Manual Testing
Show Traffic Jam Application or Crazy Eights as testing example.
Very time consuming to run all the tests, therefore expensive.
Error prone - relies on human to perceive discrepancies.
Difficult to summarize results / report.
Boring to run.
Certain errors (e.g., timing) are difficult to reproduce.
Therefore, testing gets avoided. Developers don't run all
previous tests when adding a new feature.
Results in unstable, unreliable code.
Automated Testing
"Use a program to test your program."
Automated execution with known inputs and compare
actual results to expected output.
Benefits:
Reduces errors by removing human from discrepancy detection task.
Can be run quickly (even after every change).
Provide immediate feedback.
Therefore, developers will use them. Tests will be run more
frequently,
and after every change. Resulting in more stable, reliable code.
Developers can proceed more confidently, resulting in faster
development.
Disadvantage: Investment in time to learn tools.
Demo: BlueJ and JUnit test recording for Counter.java
Counter Implementation
Testing and OO Design
Creating a testable design will result in better quality design.
The attributes that make a design easy to test are ones that
contribute to overall quality. In particularly,
decomposition
and well-specified public interfaces.
Reference:
"Thin GUI" testing strategy