Beruflich Dokumente
Kultur Dokumente
© ThoughtWorks, 2007
Objective
© ThoughtWorks, 2007
What is it?
© ThoughtWorks, 2007
Techniques
• Statement coverage
• Loop testing
• Path testing
• Branch testing
© ThoughtWorks, 2007
Statement Coverage
• 100% method coverage: All methods in all classes
are called.
• 100% statement coverage: All statements in a
method are executed.
void foo (int a, b, c, d, e) {
if (a == 0) {
return; }
int x = 0;
if ((a==b) OR ((c==d) AND bug(a) )) {
x =1; }
e = 1/x; }
© ThoughtWorks, 2007
Loop testing
© ThoughtWorks, 2007
Path testing
© ThoughtWorks, 2007
Path testing: Determine Paths
FindMean (FILE ScoreFile)
{ float SumOfScores = 0.0;
int NumberOfScores = 0;
1
float Mean=0.0; float Score;
Read(ScoreFile, Score);
2 while (! EOF(ScoreFile) {
3 if (Score > 0.0 ) {
SumOfScores = SumOfScores + Score;
4
NumberOfScores++;
}
5
Read(ScoreFile, Score); 6
}
/* Compute the mean and print the result */
7 if (NumberOfScores > 0) {
Mean = SumOfScores / NumberOfScores;
printf(“ The mean score is %f\n”, Mean); 8
} else
printf (“No scores found in file\n”); 9
}
© ThoughtWorks, 2007
Path testing: Logic flow diagram
Start
F
2
T
3
T F
4 5
7
T F
8 9
Exit
© ThoughtWorks, 2007
Branch testing
© ThoughtWorks, 2007
Grey box testing
What is it?
– Mixture of both black box and white box.
– Test the system with a basic outlook of internals.
Example
– Database testing
– Using SQL
© ThoughtWorks, 2007
Grey box testing: SQL
© ThoughtWorks, 2007
Grey box testing: My examples
Testing I did!
– Test the inventory by using the inventory table
– Reservation retrieval
– Data encryption: Credit Card number
© ThoughtWorks, 2007
Questions?
© ThoughtWorks, 2007