CS 683 Emerging Technologies: Embracing Change Spring Semester, 2001 Some Testing |
||
---|---|---|
© 2001, All Rights Reserved, SDSU & Roger Whitney San Diego State University -- This page last updated 29-Mar-01 |
Some Testing
Fowler on Testing [1]
"Make sure all tests are fully automatic and that they check their own results"
"It is better to write and run incomplete tests than not to run complete tests"
"Don't let the fear that testing can't catch all bugs stop you from writing the tests that will catch most bugs"
"Trying to write too many tests usually leads to not writing enough"
"Run your tests frequently"
"When you get a bug report, start by writing a unit test that exposes the bug"
Think of the boundary conditions and concentrate your tests there
Programming Errors
Programmers tend to make the same errors many times
Keep a list or catalog of your errors
A Short Catalog of Test Ideas
Tests develop catalogs of commonly found errors in programs
Since errors are often repeated, this helps testers find common errors
As programmers such a catalog:
Any Object
Test nil(null) references and pointers to objects
In Java/Smalltalk
String firstName = nullSmalltalk
| firstName | firstName := nil.
Strings
Test the empty string
Does the code to the correct thing when string variables/parameters are the empty string
In Java/Smalltalk an empty string is not the same as a null(nil) reference to a string
Java
String firstName = ""; String secondName = new String();Smalltalk
| firstName secondName | firstName := ''. secondName := String new
Numbers
Test the code using:
int planetIndex; //Represents the I'th planet from the Sun
0 |
Below
the smallest
|
1 |
Smallest |
9 |
Largest
(Pluto is still considered a planet)
|
10 |
Above
the largest
|
Collections
Test the code using:
Linked Structures (trees, graphs, etc.)
Test the code using:
Equality Testing of Objects
Objects have two meanings of equality
Test the code with objects equal but not identical
[1] Fowler Chapter 4, pp. 89-102
Copyright ©, All rights reserved.
2001 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA.
OpenContent license defines the copyright on this document.
Previous    visitors since 29-Mar-01