test vector

CSE 1020:Software Development
Mark Shtern
1-1
The Development Process
•
•
•
•
•
Requirements
Design
Implementation
Testing
Deployment
1-2
Interactive Development Process
• Phase 1
–
–
–
–
–
–
Requirement
Design
Implementation
Testing
Evaluation
Deployment if it is needed
• Phase 2
• Phase N
1-3
Software Testing
• A formal proof
• Testing
– Manual
– Automatic  harness is a collection of software
and test data configured to test a program unit by
running it under varying conditions and
monitoring its behaviour and outputs
1-4
Testing
• Is verification that every input that satisfied
precondition leads to the postcondition
• Testing strategy: select a sample of all the
possible valid inputs and verify correctness
only for sample
• Each element of the sample is called test case
• The sample as a whole is called the test suite
or the test vector
1-5
Test cases
•
•
•
•
Input
Loop
Random
File
1-6
Testing
• Black-box testing
• White-box testing
1-7
The Test Vector
• Domain Coverage  selected from a set that
covers the entire input domain
– Likely range
– Boundary cases
• Execution-Path Coverage  include cases to
ensure that every statement and every path in
code will executed
• Regression Testing  include cases to ensure
functionality of the product
1-8
Debugging
•
•
•
•
Error messages
Internal assertions
Debug messages
Using debuggers
1-9
Exersise 7.6
• Perform a black-box testing on a method that
takes two integer parameters and return a
string. The method’s precondition states that
two integers must be positive and less than
50. Select a test vector
(a) (-5,5) (-1,0) (1, -5) (3,0)
(b) (5,3) (3,5) (5,5) (3,3)
(c) (1,3) (3,5) (10,49) (1,49) (49,1) (49,15)
(d) (71,12) (50,5) (12,75) (51,7)
1-10
Exercise 7.7 (White box)
final int MIN = 5;
final int MAX = 10;
final int LIMIT = 5;
if (x < MIN)
output.println(“Left”);
else if (x < MAX && y < LIMIT)
output.println(“Middle”);
else if (x < MAX)
output.println (“Top”);
else
output.println(“Right”);
1-11
Exercises 7.12
• Write an app that reads a double x from the user,
ensures that it is in [0,1], or else terminates with
error message, and then computes and outputs
the following sum:
x - x2/2 + x3/3 - x4/4 …
The apps stop adding when the absolute value of
the term is less than 10-3
• Test cases
– 00
0.5  0.41
1  0.69
1-12