AutoTest - 272: Software Engineering Fall 2008 Instructor:...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
272: Software Engineering Fall 2008 Instructor: Tevfik Bultan Lecture 10: Testing, Automated Testing
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Finding Errors in Software We discussed various approaches to finding errors in programs Static analysis techniques and tools such as automated theorem proving, ESC/Java model checking, Java pathfinder Dynamic monitoring of assertions and contracts JContractor JML runtime assertion checker Although these are interesting and promising research areas the most common way of looking for software errors in industry is testing Testing: Checking correctness of software by executing the software on some inputs (test cases)
Background image of page 2
Software Testing Goal of testing finding faults in the software demonstrating that there are no faults in the software (for the test cases that has been used during testing) It is not possible to prove that there are no faults in the software using testing Testing should help locate errors, not just detect their presence a “yes/no” answer to the question “is the program correct?” is not very helpful Testing should be repeatable could be difficult for distributed or concurrent software effect of the environment, uninitialized variables
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Testing Software is Hard If you are testing a bridge’s ability to sustain weight, and you test it with 1000 tons you can infer that it will sustain weight 1000 tons This kind of reasoning does not work for software systems software systems are not linear nor continuous Exhaustively testing all possible input/output combinations is too expensive the number of test cases increase exponentially with the number of input/output variables
Background image of page 4
Some Definitions Let P be a program and let D denote its input domain A test case d is an element of input domain d D a test case gives a valuation for all the input variables of the program A test set T is a finite set of test cases, i.e., a subset of D , T D The basic difficulty in testing is finding a test set that will uncover the faults in the program Exhaustive testing corresponds to setting T = D
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Exhaustive Testing is Hard Number of possible test cases (assuming 32 bit integers) 2 32 × 2 32 = 2 64 Do bigger test sets help? Test set {(x=3,y=2), (x=2,y=3)} will detect the error Test set {(x=3,y=2),(x=4,y=3),(x=5,y=1)} will not detect the error although it has more test cases It is not the number of test cases But, if T 1 T 2 , then T 1 will detect every fault detected by T 2 int max(int x, int y) { if (x > y) return x; else return x; }
Background image of page 6
Exhaustive Testing Assume that the input for the max procedure was an integer array of size n Number of test cases: 2 32 × n Assume that the size of the input array is not bounded Number of test cases: The point is, naive exhaustive testing is pretty hopeless
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Random Testing Use a random number generator to generate test cases Derive estimates for the reliability of the software using some probabilistic analysis Coverage is a problem
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 80

AutoTest - 272: Software Engineering Fall 2008 Instructor:...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online