Code is typically considered beautiful if it does what it's supposed to do with unique elegance and economic.
Tests can also be beautiful themselves.
More importantly, they can play a key role in helping you create more beautiful code.
From Nguyen Hoang Viet - Asskicker at Silicon Straits Saigon
3. The bug:
int mid = (low + high) / 2;
Solution:
int mid = low + ((high - low) / 2);
Show off:
int mid = (low + high) >>> 1;
Monday, October 21, 13
4. My initial testing
strategy
Start with smoke tests.
Add some boundary value tests
Continue with various thorough and
exhaustive types of tests
Finally, add some performance tests
Monday, October 21, 13
5. Smoking Allowed (and
Encouraged)
These are designed to make sure that the
code does the right thing when used in the
most basic manner
Monday, October 21, 13
7. Pushing the Boundaries
Boundary testing is designed to explore and
validate what happens when the code has to
deal with extremes and corner cases
Monday, October 21, 13
11. Random Acts of Testing
A way to generate a large and diverse set of
inputs
A set of generalized assertions that will
work on any input
Monday, October 21, 13
14. Conclusion
Unit Tests allows you to make big changes to
code quickly
Your tests give you confidence that you've
done enough for now and can stop tweaking
and move on to the next thing
Good unit tests can help document and
define what something is supposed to do
Unit Tests help you really understand the
design of the code you are working on
Monday, October 21, 13