Presentation is loading. Please wait.

Presentation is loading. Please wait.

Software testing techniques Spring 2009 Csci565: Theory and Practice of Software Testing1.

Similar presentations


Presentation on theme: "Software testing techniques Spring 2009 Csci565: Theory and Practice of Software Testing1."— Presentation transcript:

1 Software testing techniques Spring 2009 Csci565: Theory and Practice of Software Testing1

2  Write a set of test cases (i.e., specific sets of data to test a simple program  Program description  The program reads three integer values from an input dialog  The three values represent the lengths of sides of a triangle  The program displays a message that states whether the triangle is ▪ Scalene ▪ Isosceles ▪ equilateral Csci565: Theory and Practice of Software Testing2

3  A scalene triangle is one where no two sides are equal  Isosceles has two equal sides  Equilateral has three sides equal length  Angles opposite the equal sides in an isosceles also are equal Csci565: Theory and Practice of Software Testing3

4  Give yourself one point for each “yes” answer 1. Do you have a test case that represent a valid scalene triangle? ( note test cases such as 1,2,3, and 2,5,10 do not warrant a “yes” 2. Do you have a test case that represents a valid equilateral triangle? 3. Do you have a test-case that represents a valid isosceles triangle ( 2,2, 4 would not count because it is not a valid triangle) 4. Do you have at least three test cases that represent valid isosceles triangles such that you have tried all three permutations of two equal sides (such as 3,3,4; 3,4,3, 4,3,3)? 5. Do you have a test case in which one side has a zero value? 6. Do you have a test case in which one side has a negative value? 7. Do you have a test case with three integers greater than zero such that the sum of two of the number is equal to the third? ( e.g. 1,2,3) Csci565: Theory and Practice of Software Testing4

5 8. Do you have at least three test cases in category 7 such that you have tried all three permutations where the length of one side is equal to the sum of the lengths of the other two sides (e.g. 1,2,3; 1,3,2; and 3,1,2)? 9. Do you have a test case with three integers greater than zero such that the sum of two of the numbers is less than the third (e.g. 1,2, 4 or 12, 15, 30)? 10. Do you have a t least three test cases in category 9 such that you have tried all three permutations (e.g. 1,2,4: 1,4,2: and 4,1,2)? 11. Do you have a test case in which all sides are zero (0,0,0)? 12. Do you have at least one test case specifying non-integer value ( such as 2.5, 3.5., 5.5)? 13. Do you have at least one test case specifying the wrong number of values (two rather than three integers) 14. For each test case did you specify the expected output from the program in addition to the input values Csci565: Theory and Practice of Software Testing5

6  Highly qualified professional programmers score (on average ) 7.8 out of possible 14  Congratulations if you have done > 7.8  Now consider testing a 100,000 statement air traffic control system, a compiler, or even payroll system, C++ programs  Bottom line: complete testing of real-world program is very difficult test Csci565: Theory and Practice of Software Testing6

7  Common Abstract Models that have used for various testing techniques include 1. Logical expressions (predicates/clauses) 2. Graphs 3. Input space partitioning ( possible values used as inputs) 4. Syntactic based testing ( use a syntactic description such BNF for recognizing /generating testing artifacts) Csci565: Theory and Practice of Software Testing7

8  Discuss discrete math and functional testing  Set theory  Set definition  The empty set  Set operations  Set relations  Set partitions  Set identities  Functions and relations  Propositional logic Csci565: Theory and Practice of Software Testing8

9  Sets are collections of objects or things  E.g.  A set of people  A set of shops  A set of numbers  All these sets characterized mathematically by  Their elements (or members)  Well-defined relation between elements (  ) ▪ Given an object “a” and a set S, a  S Csci565: Theory and Practice of Software Testing9

10  There are (at least) two way to define sets  List the elements of sets ▪ E.g., ▪ set of rich European countries  {France, Germany, UK, Italy}  Or, write a predicate (condition) on membership of elements (set comprehension) ▪ {x| x  EU  rich(x)} ▪ Very precise (GOOD) ▪ Can be very complex (BAD) Csci565: Theory and Practice of Software Testing10

11  The set contains no elements  It is a unique set  Denoted by  or {} Csci565: Theory and Practice of Software Testing11

12  Much of the expressive power of set comes from basic operations  Union  Intersection  Complement  Difference Csci565: Theory and Practice of Software Testing12

13  Difference: A – B = { x: x  A  x  B} Csci565: Theory and Practice of Software Testing13

14  Works with notion of ordered pair ( )  The Cartesian product of two sets A and B is the set  A  B = { : x  A  y  B}  E.g., A = {a, b}, B= {1, 2}, ▪ A  B = {,,, }  Unordered pair (a, b)  for a  b,  (a, b) = (b,a) but  Csci565: Theory and Practice of Software Testing14

15  Given two sets, A and B  A  B ( A is a subset of B) ▪ iff a  A  a  B  A  B ( A is a proper subset of B), ▪ iff A  B  B-A   A = B ( A and B are equal) ▪ iff A  B  B  A Csci565: Theory and Practice of Software Testing15

16  Partition means to divide up a whole into pieces such that  everything is in some piece (completeness)  nothing is left out (no gap)  Set partitioning is very important for testers  Completeness (all requirements/things is specified)  Non-redundancy (no overlap)  Definition  Given a set A, and a set of subsets A1, A2,…An of A, the subsets are a partition of A iff ▪ A1  A2  …  An=A ▪ i  j  A i  A j =  Csci565: Theory and Practice of Software Testing16

17 NameExpression Identity laws A  =A; A  U=A Domination Laws A  U=U A  =  Idempotent laws A  A =A A  A=A Complementation Laws(A’)’=A Associative laws A  (B  C)= (A  B)  C Distributive laws A  (B  C)= (A  B)  (A  C) deMorgan’s Laws (A  B)’= A’  B’ (A  B)’= A’  B’ 17 Csci565: Theory and Practice of Software Testing

18  Central notion to software development and testing  Associate elements of sets (domain and range)  A domain element cannot be associated with more than one range element (well-behaved)  Any program can be seen as a function  takes some input and generate some outputs ▪ F: A  B ▪ F  A  B Csci565: Theory and Practice of Software Testing18

19  A set called image of A under f  F(A) = { b i : b i  B  a i  A  b i =f(a i ) }  F is a function from A onto B iff f(A) = B  F is a function from A into B iff f(A)  B  F is 1-to-1 function from A to B  iff,  a i, a j  A: a i  a j  f(a i )  f(a j )  F is M-to-1 function from A  iff,  a i, a j  A: a i  a j  f(a i ) =f(a j ) Csci565: Theory and Practice of Software Testing19

20  The general form of function  One element in domain can be associated/mapped to one or more elements in the range  Given two sets A and B, a relation R is a subset of the A  B  Cardinality of R  One-to-one (e.g., relationship has between students and IDs)  Many-to-one (e.g., relationship teach between Instructor and course)  One-to-many (e.g., relationship dependence between Emp., and their dependents)  Many-to-many (e.g., relationship enroll between students and courses)  The participation of R  Total: iff every element of A is in some ordered pair in R  Partial: iff some element of A is not in some ordered pair in R  Onto: iff every element of B is in some ordered pair in R  Into: iff some elements of B is not in some ordered pair in R Csci565: Theory and Practice of Software Testing20

21  Assume that R is relation on a set A  R is reflexive if for every a  A, aRa  R is symmetric if for every a and b  A, if aRb, then bRa  R is transitive if for every a, b, and c  A, then aRc  R is anti-symmetric if for every,a,b>,  R, then a=b  R is an ordering relation on A if R ▪ Reflexive, anti-symmetric and transitive ▪ E.g.,  Csci565: Theory and Practice of Software Testing21

22  R is an equivalence relation on A if R ▪ Reflexive, symmetric and transitive  The equality relation on any set A is a simple example of an equivalence relation because all three properties can be checked easily  E.g., suppose employees is divided into groups (departments, D 1, D 2,..D n ) ▪ e1 and e2 is related if they work on the same department (e1 R e2) ▪ The relation is reflexive because any employee is in its own Di ▪ The relation is symmetric because if e1 and e2 are in the same D i, then e2 and e1 are in same D i ) ▪ The relation is transitive because if e1 and e2 are in the same D i, and e2 and e3 is also in the same D i, then e1 and e3 is same D i ) Csci565: Theory and Practice of Software Testing22

23 Csci565: Theory and Practice of Software Testing23 Q u e s t i o n sQ u e s t i o n sQ u e s t i o n s


Download ppt "Software testing techniques Spring 2009 Csci565: Theory and Practice of Software Testing1."

Similar presentations


Ads by Google