Software Testing Part I: Preliminaries Aditya P. Mathur Purdue University July 20-24, Technical Services Company Indianapolis. Graduate.

Slides:



Advertisements
Similar presentations
Object Oriented Analysis And Design-IT0207 iiI Semester
Advertisements

Verification and Validation
Testing and Quality Assurance
Annoucements  Next labs 9 and 10 are paired for everyone. So don’t miss the lab.  There is a review session for the quiz on Monday, November 4, at 8:00.
10 Software Engineering Foundations of Computer Science ã Cengage Learning.
Foundations of Software Testing Chapter 1: Section 1.19 Coverage Principle and the Saturation Effect Aditya P. Mathur Purdue University Last update: August.
Model Based Software Testing Preliminaries Aditya P. Mathur Purdue University Fall 2005 Last update: August 18, 2005.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
Coverage Principle: A Mantra for Software Testing and Reliability Aditya P. Mathur Purdue University August 28, Cadence Labs, Chelmsford Last update:August.
Software Testing. “Software and Cathedrals are much the same: First we build them, then we pray!!!” -Sam Redwine, Jr.
Chapter 11: Testing The dynamic verification of the behavior of a program on a finite set of test cases, suitable selected from the usually infinite execution.
Software Integration and Documenting
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
Software Testing Verification and validation planning Software inspections Software Inspection vs. Testing Automated static analysis Cleanroom software.
©Ian Sommerville 2000Software Engineering, 6th edition. Chapter 19Slide 1 Verification and Validation l Assuring that a software system meets a user's.
Dr. Pedro Mejia Alvarez Software Testing Slide 1 Software Testing: Building Test Cases.
Verification and Validation Yonsei University 2 nd Semester, 2014 Sanghyun Park.
Software Quality Assurance Lecture #8 By: Faraz Ahmed.
University of Palestine software engineering department Testing of Software Systems Fundamentals of testing instructor: Tasneem Darwish.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 22 Slide 1 Verification and Validation.
CMSC 345 Fall 2000 Unit Testing. The testing process.
Software Testing Sudipto Ghosh CS 406 Fall 99(Also used later) November 2, 1999.
Chapter 8 – Software Testing Lecture 1 1Chapter 8 Software testing The bearing of a child takes nine months, no matter how many women are assigned. Many.
Verification and Validation Overview References: Shach, Object Oriented and Classical Software Engineering Pressman, Software Engineering: a Practitioner’s.
Coverage – “Systematic” Testing Chapter 20. Dividing the input space for failure search Testing requires selecting inputs to try on the program, but how.
Foundations of Software Testing Chapter 5: Test Selection, Minimization, and Prioritization for Regression Testing Last update: September 3, 2007 These.
Requirements-based Test Generation for Functional Testing (© 2012 Professor W. Eric Wong, The University of Texas at Dallas) 1 W. Eric Wong Department.
Foundations of Software Testing Chapter 1: Preliminaries Last update: September 3, 2007 These slides are copyrighted. They are for use with the Foundations.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 22 Slide 1 Software Verification, Validation and Testing.
Today’s Agenda  HW #1  Finish Introduction  Input Space Partitioning Software Testing and Maintenance 1.
White Box-based Coverage Testing (© 2012 Professor W. Eric Wong, The University of Texas at Dallas) 111 W. Eric Wong Department of Computer Science The.
Today’s Agenda  Reminder: HW #1 Due next class  Quick Review  Input Space Partitioning Software Testing and Maintenance 1.
Software Engineering1  Verification: The software should conform to its specification  Validation: The software should do what the user really requires.
1 Software Testing Strategies: Approaches, Issues, Testing Tools.
HNDIT23082 Lecture 09:Software Testing. Validations and Verification Validation and verification ( V & V ) is the name given to the checking and analysis.
SCOPE DEFINITION,VERIFICATION AND CONTROL Ashima Wadhwa.
1 Phase Testing. Janice Regan, For each group of units Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine.
1 © 2011 Professor W. Eric Wong, The University of Texas at Dallas Requirements-based Test Generation for Functional Testing W. Eric Wong Department of.
Agenda  Quick Review  Finish Introduction  Java Threads.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 23, 1999.
Testing Overview Software Reliability Techniques Testing Concepts CEN 4010 Class 24 – 11/17.
Foundations of Software Testing Chapter 7: Test Adequacy Measurement and Enhancement Using Mutation Last update: September 3, 2007 These slides are copyrighted.
Lecturer: Eng. Mohamed Adam Isak PH.D Researcher in CS M.Sc. and B.Sc. of Information Technology Engineering, Lecturer in University of Somalia and Mogadishu.
Foundations of Software Testing Chapter 5: Test Selection, Minimization, and Prioritization for Regression Testing Last update: September 3, 2007 These.
Week # 4 Quality Assurance Software Quality Engineering 1.
Foundations of Software Testing Chapter 7: Test Adequacy Measurement and Enhancement Using Mutation Last update: September 3, 2007 These slides are copyrighted.
Software Testing. SE, Testing, Hans van Vliet, © Nasty question  Suppose you are being asked to lead the team to test the software that controls.
SOFTWARE TESTING AND QUALITY ASSURANCE. Software Testing.
1 Software Testing. 2 What is Software Testing ? Testing is a verification and validation activity that is performed by executing program code.
CS223: Software Engineering Lecture 25: Software Testing.
©Ian Sommerville 2000Software Engineering, 6th edition. Chapter 19Slide 1 Verification and Validation l Assuring that a software system meets a user's.
Laurea Triennale in Informatica – Corso di Ingegneria del Software I – A.A. 2006/2007 Andrea Polini XVIII. Software Testing.
Aditya P. Mathur Purdue University
Software Testing Day 1: Preliminaries
CSC 480 Software Engineering
Verification and Testing
Verification and Validation Overview
Aditya P. Mathur Purdue University
BASICS OF SOFTWARE TESTING Chapter 1. Topics to be covered 1. Humans and errors, 2. Testing and Debugging, 3. Software Quality- Correctness Reliability.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Software Reliability Models.
Software testing strategies 2
Verification and Validation Unit Testing
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Software Verification and Validation
Software Verification and Validation
Coverage Principle: A Mantra for Software Testing and Reliability
Software Verification and Validation
What is a System? A system is a collection of interrelated components that work together to perform a specific task.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Presentation transcript:

Software Testing Part I: Preliminaries Aditya P. Mathur Purdue University July 20-24, Technical Services Company Indianapolis. Graduate Assistants : Joao Cangussu Sudipto Ghosh Priya Govindrajan Last update: July 15, 1998

Software Testing: Preliminaries2 Class schedule 4 Monday-Thursday July –8-9:15amLecture session 1/Quiz –9:15-9:30amBreak –9:30-10:45amLecture session 2 –10:45-11amBreak –11-12noonLecture session 3 –12-1pmLunch –1-5pmLab session (breaks as needed)

Software Testing: Preliminaries3 Class schedule-continued 4 Friday July 24 –8-8:30amReview and Q&A –8:30-10amFinal examination –10-10:15amBreak –10:15-12noonSERT review –12-1pmLunch

Software Testing: Preliminaries4 Class schedule-continued 4 Friday July 24 –1-2pmLab session –2-3pmWeek 10 and SERT feedback –3pmClasses end...prepare for the banquet!

Software Testing: Preliminaries5 Course Organization Part I: Preliminaries Part II:Functional Testing Part III:Test Assessment and improvement Part IV:Special Topics

Software Testing: Preliminaries6 Text and supplementary reading 4 The craft of software testing by Brian Marick, Prentice Hall, Reading: –A data-flow oriented program testing strategy, J. W. Laski and B. Korel, IEEE Transactions on Software Engineering, VOL. SE-9, NO. 3, May 1983, pp

Software Testing: Preliminaries7 Text and supplementary reading –The combinatorial approach to automatic test data generation, D. Cohen et al., IEEE Software, VOL. 13, NO. 5, September 1996, pp –Comparing the error detection effectiveness of mutation and data flow testing, in your notes, part III.

Software Testing: Preliminaries8 Text and supplementary reading 4 Effect of test set minimization on the fault detection effectiveness of the all-uses criterion, in your notes, part III. 4 Effect of test set size and block coverage on the fault detection effectiveness, in your notes, part III.

Software Testing: Preliminaries9 Evaluation-Lectures Quiz I: Preliminaries: 8:30-9am 7/21/9810 points Quiz II: Functional testing: 8:30-9am 7/22/9810 points Quiz III: Test assessment: 8:30-9am 7/23/9810 points Final Exam: Comprehensive: 10:30-12noon7/24/98 25points Total lectures: 55%

Software Testing: Preliminaries10 Evaluation-Laboratories Lab 1:7/20/9810% Lab 2:7/21/9810% Lab 3:7/22/9815% Lab 4:7/23/9810% Total labs: 45% Total testing course:lectures+labs.=100%

Software Testing: Preliminaries11 Part I: Preliminaries Learning Objectives 4 What is testing? How does it differ from verification? 4 How and why does testing improve our confidence in program correctness? 4 What is coverage and what role does it play in testing? 4 What are the different types of testing?

Software Testing: Preliminaries12 Testing: Preliminaries 4 What is testing? –The act of checking if a part or a product performs as expected. 4 Why test? –Gain confidence in the correctness of a part or a product. –Check if there are any errors in a part or a product.

Software Testing: Preliminaries13 What to test? 4 During software lifecycle several products are generated. 4 Examples: –Requirements document –Design document –Software subsystems –Software system

Software Testing: Preliminaries14 Test all! 4 Each of these products needs testing. 4 Methods for testing various products are different. 4 Examples: –Test a requirements document using scenario construction and simulation –Test a design document using simulation. –Test a subsystem using functional testing.

Software Testing: Preliminaries15 What is our focus? 4 We focus on testing programs. 4 Programs may be subsystems or complete systems. 4 These are written in a formal programming language. 4 There is a large collection of techniques and tools to test programs.

Software Testing: Preliminaries16 Few basic terms 4 Program: –A collection of functions, as in C, or a collection of classes as in java. 4 Specification –Description of requirements for a program. This might be formal or informal.

Software Testing: Preliminaries17 Few basic terms-continued 4 Test case or test input –A set of values of input variables of a program. Values of environment variables are also included. 4 Test set –Set of test inputs 4 Program execution –Execution of a program on a test input.

Software Testing: Preliminaries18 Few basic terms-continued 4 Oracle –A function that determines whether or not the results of executing a program under test is as per the program’s specifications.

Software Testing: Preliminaries19 Correctness 4 Let P be a program (say, an integer sort program). 4 Let S denote the specification for P. 4 For sort let S be:

Software Testing: Preliminaries20 Sample Specification –P takes as input an integer N>0 and a sequence of N integers called elements of the sequence. –Let K denote any element of this sequence, –P sorts the input sequence in descending order and prints the sorted sequence.

Software Testing: Preliminaries21 Correctness again 4 P is considered correct with respect to a specification S if and only if: –For each valid input the output of P is in accordance with the specification S.

Software Testing: Preliminaries22 Errors, defects, faults 4 Error: A mistake made by a programmer Example: Misunderstood the requirements. 4 Defect/fault: Manifestation of an error in a program. Example: Incorrect code: if (a<b) {foo(a,b);} Correct code: if (a>b) {foo(a,b);}

Software Testing: Preliminaries23 Failure 4 Incorrect program behavior due to a fault in the program. 4 Failure can be determined only with respect to a set of requirement specifications. 4 A necessary condition for a failure to occur is that execution of the program force the erroneous portion of the program to be executed. What is the sufficiency condition?

Software Testing: Preliminaries24 Errors and failure Program Inputs Error-revealing inputs cause failure Outputs Erroneous outputs indicate failure

Software Testing: Preliminaries25 Debugging 4 Suppose that a failure is detected during the testing of P. 4 The process of finding and removing the cause of this failure is known as debugging. 4 The word bug is slang for fault. 4 Testing usually leads to debugging 4 Testing and debugging usually happen in a cycle.

Software Testing: Preliminaries26 Test-debug cycle Test Debug Failure? Testing complete? Done! Yes No YesNo

Software Testing: Preliminaries27 Testing and code inspection 4 Code inspection is a technique whereby the source code is inspected for possible errors. 4 Code inspection is generally considered complementary to testing. Neither is more important than the other! 4 One is not likely to replace testing by code inspection or by verification.

Software Testing: Preliminaries28 Testing for correctness? 4 Identify the input domain of P. 4 Execute P against each element of the input domain. 4 For each execution of P, check if P generates the correct output as per its specification S.

Software Testing: Preliminaries29 What is an input domain ? 4 Input domain of a program P is the set of all valid inputs that P can expect. 4 The size of an input domain is the number of elements in it. 4 An input domain could be finite or infinite. 4 Finite input domains might be very large!

Software Testing: Preliminaries30 Identifying the input domain 4 For the sort program: N: size of the sequence, K: each element of the sequence. –Example: For N<3, e=3, some sequences in the input domain are: [ ]: An empty sequence (N=0). [0]: A sequence of size 1 (N=1) [2 1]:A sequence of size 2 (N=2).

Software Testing: Preliminaries31 Size of an input domain 4 Suppose that 4 The size of the input domain is the number of all sequences of size 0, 1, 2, and so on. 4 The size can be computed as:

Software Testing: Preliminaries32 Testing for correctness? Sorry! 4 To test for correctness P needs to be executed on all inputs. 4 For our example, it will take several light years to execute a program on all inputs on the most powerful computers of today!

Software Testing: Preliminaries33 Exhaustive Testing 4 This form of testing is also known as exhaustive testing as we execute P on all elements of the input domain. 4 For most programs exhaustive testing is not feasible. 4 What is the alternative?

Software Testing: Preliminaries34 Verification 4 Verification for correctness is different from testing for correctness. 4 There are techniques for program verification which we will not discuss.

Software Testing: Preliminaries35 Partition Testing 4 In this form of testing the input domain is partitioned into a finite number of sub- domains. 4 P is then executed on a few elements of each sub-domain. 4 Let us go back to the sort program.

Software Testing: Preliminaries36 Sub-domains 4 Suppose that and e=3. The size of the partitions is : 4 We can divide the input domain into three sub-domains as shown

Software Testing: Preliminaries37 Fewer test inputs 4 Now sort can be tested on one element selected from each domain. 4 For example, one set of three inputs is: [ ]Empty sequence from sub-domain 1. [2]Sequence from sub-domain 2. [2 0]Sequence from sub-domain 3. 4 We have thus reduced the number of inputs used for testing from 13 to 3!

Software Testing: Preliminaries38 Confidence in your program 4 Confidence is a measure of one’s belief in the correctness of the program. 4 Correctness is not measured in binary terms: a correct or an incorrect program. 4 Instead, it is measured as the probability of correct operation of a program when used in various scenarios.

Software Testing: Preliminaries39 Measures of confidence 4 Reliability: Probability that a program will function correctly in a given environment over a certain number of executions. We do not plan to cover Reliability. 4 Test completeness: The extent to which a program has been tested and errors found have been removed.

Software Testing: Preliminaries40 Example: Increase in Confidence 4 We consider a non-programming example to illustrate what is meant by “increase in confidence.” 4 Example: A rectangular field has been prepared to certain specifications. –One item in the specifications is: “ There should be no stones remaining in the field.”

Software Testing: Preliminaries41 Rectangular Field X Y Search for stones inside the rectangle. 0L W

Software Testing: Preliminaries42 Organizing the search 4 We divide the entire field into smaller search rectangles. 4 The length and breadth of each search rectangle is one half that of the smallest stone.

Software Testing: Preliminaries43 Testing the rectangular field 4 The field has been prepared and our task is to test it to make sure that it has no stones. 4 How should we organize our search?

Software Testing: Preliminaries44 Partitioning the field 4 We divide the entire field into smaller search rectangles. 4 The length and breadth of each search rectangle is one half that of the smallest stone.

Software Testing: Preliminaries45 Partitioning into search rectangles X Y Stone Width Length

Software Testing: Preliminaries46 Input domain 4 Input domain is the set of all possible inputs to the search process. 4 In our example this is the set of all points in the field. Thus, the input domain is infinite! 4 To reduce the size of the input domain we partition the field into finite size rectangles.

Software Testing: Preliminaries47 Rectangle size 4 The length and breadth of each search rectangle is one half that of the smallest stone. 4 This ensures that each stone covers at least one rectangle. (Is this always true?)

Software Testing: Preliminaries48 Constraints 4 Testing must be completed in less than H hours. 4 Any stone found during testing is removed. 4 Upon completion of testing the probability of finding a stone must be less than p.

Software Testing: Preliminaries49 Number of search rectangles 4 Let L: Length of the field W:Width of the field l:Length of the smallest stone w:Width of the smallest stone 4 Size of each rectangle: l/2 x w/2 4 Number of search rectangles (R)=(L/l)*(W/w)*4 4 Assume that L/l and W/w are integers.

Software Testing: Preliminaries50 Time to test 4 Let t be the time to look inside one search rectangle. No rectangle is examined more than once. 4 Let o be the overhead in moving from one search rectangle to another. 4 Total time to search (T)=R*t+(R-1)*o 4 Testing with R rectangles is feasible only if T<H.

Software Testing: Preliminaries51 Partitioning the input domain 4 This set consists of all search rectangles (R). 4 Number of partitions of the input domain is finite (=R). 4 However, if T>H then the number of partitions is is too large and scanning each rectangle once is infeasible. 4 What should we do in such a situation?

Software Testing: Preliminaries52 Option 1: Do a limited search 4 Of the R search rectangles we examine only r where r is such that (t*r+o*(r-1)) < H. 4 This limited search will satisfy the time constraint. 4 Will it satisfy the probability constraint?

Software Testing: Preliminaries53 Distribution of stones 4 To satisfy the probability constraint we must scan enough search rectangles so that the probability of finding a stone, after testing, remains less than p. 4 Let us assume that –there are stones remaining after i test cycles.

Software Testing: Preliminaries54 Distribution of stones –There are search rectangles remaining after i test cycles. –Stones are distributed uniformly over the field –An estimate of the probability of finding a stone in a randomly selected remaining search rectangle is

Software Testing: Preliminaries55 Probability constraint 4 We will stop looking into rectangles if 4 Can we really apply this test method in practice?

Software Testing: Preliminaries56 Confidence 4 Number of stones in the field is not known in advance. 4 Hence we cannot compute the probability of finding a stone after a certain number of rectangles have been examined. 4 The best we can do is to scan as many rectangles as we can and remove the stones found.

Software Testing: Preliminaries57 Coverage 4 After a rectangle has been scanned for a stone and any stone found has been removed, we say that the rectangle has been covered. 4 Suppose that r rectangles have been scanned from a total of R. Then we say that the coverage is r/R.

Software Testing: Preliminaries58 Coverage and confidence 4 What happens when coverage increases? As coverage increases so does our confidence in a “stone-free” field. 4 In this example, when the coverage reaches 100%, all stones have been found and removed. Can you think of a situation when this might not be true?

Software Testing: Preliminaries59 Option 2: Reduce number of partitions 4 If the number of rectangles to scan is too large, we can increase the size of a rectangle. This reduces the number of rectangles. 4 Increasing the size of a rectangle also implies that there might be more than one stone within a rectangle.

Software Testing: Preliminaries60 Rectangle size 4 As a stone may now be smaller than a rectangle, detecting a stone inside a rectangle is not guaranteed. 4 Despite this fact our confidence in a “stone- free” field increases with coverage. 4 However, when the coverage reaches100% we cannot guarantee a “stone-free” field.

Software Testing: Preliminaries61 Coverage vs. Confidence Coverage Confidence 1(=100%) 1 0 Does not imply that the field is “stone-free”.

Software Testing: Preliminaries62 Rectangle size p=Probability of detecting a stone inside a rectangle, given that the stone is there. t=time to complete a test. smalllarge t, p

Software Testing: Preliminaries63 Analogy Field:Program Stone:Error Scan a rectangle:Test program on one input Remove stone:Remove error Partition:Subset of input domain Size of stone:Size of an error Rectangle size:Size of a partition

Software Testing: Preliminaries64 Analogy…continued Size of an error is the number of inputs in the input domain each of which will cause a failure due to that error. Inputs that cause failure due to Error 1 Inputs that cause failure due to Error 2. Error 1 is larger than Error 2. Input domain

Software Testing: Preliminaries65 Confidence and probability 4 Increase in coverage increases our confidence in a “stone-free” field. 4 It might not increase the probability that the field is “stone-free”. 4 Important: Increase in confidence is NOT justified if detected stones are not guaranteed to be removed!

Software Testing: Preliminaries66 Types of testing Source of clues for test input construction Object under test Basis for classification All of these methods can be applied here.

Software Testing: Preliminaries67 Testing: based on source of test inputs 4 Functional testing/specification testing/black-box testing/conformance testing: –Clues for test input generation come from requirements. 4 White-box testing/coverage testing/code- based testing –Clues come from program text.

Software Testing: Preliminaries68 Testing: based on source of test inputs 4 Stress testing –Clues come from “load” requirements. For example, a telephone system must be able to handle 1000 calls over any 1-minute interval. What happens when the system is loaded or overloaded?

Software Testing: Preliminaries69 Testing: based on source of test inputs 4 Performance testing –Clues come from performance requirements. For example, each call must be processed in less than 5 seconds. Does the system process each call in less than 5 seconds? 4 Fault- or error- based testing –Clues come from the faults that are injected into the program text or are hypothesized to be in the program.

Software Testing: Preliminaries70 Testing: based on source of test inputs 4 Random testing –Clues come from requirements. Test are generated randomly using these clues. 4 Robustness testing –Clues come from requirements. The goal is to test a program under scenarios not stipulated in the requirements.

Software Testing: Preliminaries71 Testing: based on source of test inputs 4 OO testing –Clues come from the requirements and the design of an OO-program. 4 Protocol testing –Clues come from the specification of a protocol. As, for example, when testing for a communication protocol.

Software Testing: Preliminaries72 Testing: based on item under test 4 Unit testing Testing of a program unit. A unit is the smallest testable piece of a program. One or more units form a subsystem. 4 Subsystem testing –Testing of a subsystem. A subsystem is a collection of units that cooperate to provide a part of system functionality

Software Testing: Preliminaries73 Testing: based on item under test 4 Integration testing –Testing of subsystems that are being integrated to form a larger subsystem or a complete system. 4 System testing –Testing of a complete system.

Software Testing: Preliminaries74 Testing: based on item under test 4 Regression testing –Test a subsystem or a system on a subset of the set of existing test inputs to check if it continues to function correctly after changes have been made to an older version. And the list goes on and on!

Software Testing: Preliminaries75 Test input construction and objects under test Test object Source of clues for test inputs unit subsystem system Requirements Code

Software Testing: Preliminaries76 Summary: Terms 4 Testing and debugging 4 Specification 4 Correctness 4 Input domain 4 Exhaustive testing 4 Confidence

Software Testing: Preliminaries77 Summary: Terms 4 Reliability 4 Coverage 4 Error, defect, fault, failure 4 Debugging, test-debug cycle 4 Types of testing, basis for classification

Software Testing: Preliminaries78 Summary: Questions 4 What is the effect of reducing the partition size on probability of finding errors? 4 How does coverage effect our confidence in program correctness? 4 Does 100% coverage imply that a program is fault-free? 4 What decides the type of testing?