170 likes | 358 Views
Software Testing. Necessary to measure and certify quality in software SOS 10.1-10.3 Pressman Chapter 13. Software Testing. Often a neglected activity May use 20% of total development effort Can not do exhaustive testing Hard for programmer to test own program
E N D
Software Testing Necessary to measure and certify quality in software SOS 10.1-10.3 Pressman Chapter 13
Software Testing • Often a neglected activity • May use 20% of total development effort • Can not do exhaustive testing • Hard for programmer to test own program • subconsciously we want testing to succeed
Historical Overview • 1960’s - very little testing • 1968 - Hoare’s paper on proving • 1970’s - “only good test is one that fails” • early 70’s - reliability • 1975 - Goodenough & Gerhart’s paper on finite test sets • mid 70’s - (industrial) separate test teams • late 70’s - test coverage measures • late 90’s – object oriented testing
Typical Solutions • We can’t do exhaustive testing • We can’t test even a moderate percentage of the possibilities • We can try to choose good tests • Solution 1 : Independent Test Teams • Solution 2 : Coverage Measures
Two common types of test coverage • functional testing (cs541) • black box • based on requirements • structural testing (cs540) • white box • based on code
TTYP 1 • Assume that you are given a program to test. The program accepts three numbers, interprets those numbers as lengths of the sides of a triangle, and returns the type of the triangle (scalene, isosceles, or equilateral) • Write a good set of test cases for this program
Triangle Example cin >> a >> b >> c ; type = “scalene”; if (a == b || a == c || b == c) type= “isoscoles”; if (a == b && a == c) type = “equilateral”; if (a >= b+c || b >= a+c || c >= a+b) type=“not a triangle”; if (a <= 0 || b <= 0 || c <= 0) type=“bad input”; cout<< type; TTYP 2 – what is a set of tests that execute all statements?
Control Flow Graph TTYP3 – what are the paths through this code?
A Model of Testing - Mappings • a program maps elements of the domain to elements of the range • the specification also specifies a mapping of the domain to the range • correctness is that the program is the same mapping as the specification
Subdomain – typical definition • A subdomain is a set of input points (data points, tests, etc) that are treated identically by the program (or almost identically). That is, they usually take the same path through the program and the same operations are applied to the values. • Subdomains are normally mutually exclusive
TTYP 4 • What is a set of subdomains for the triangle code?
Program vs Specification • Correctness is only in respect to a specification • a program without a specification is correct • Testing can not ignore the specification • Testing can not ignore the program
Thursday, Oct 26 Structural Testing • SOS chapter 10.3.4 and 10.6 • PLQ on structural testing