Week 5-6 MondayTuesdayWednesdayThursdayFriday Testing I No reading Group meetings MidtermNo Section Testing II Progress report due Readings out Testing.

Slides:



Advertisements
Similar presentations
Chapter 14 Software Testing Techniques - Testing fundamentals - White-box testing - Black-box testing - Object-oriented testing methods (Source: Pressman,
Advertisements

Software Testing Technique. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves.
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
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.
CSE 331 SOFTWARE DESIGN & IMPLEMENTATION TESTING II Autumn 2011.
Testing, cont. Based on material by Michael Ernst, University of Washington.
IMSE Week 18 White Box or Structural Testing Reading:Sommerville (4th edition) ch 22 orPressman (4th edition) ch 16.
Testing an individual module
1 Software Testing and Quality Assurance Lecture 5 - Software Testing Techniques.
CSE 403 Lecture 13 Black/White-Box Testing Reading: Software Testing: Principles and Practices, Ch. 3-4 (Desikan, Ramesh) slides created by Marty Stepp.
1 Functional Testing Motivation Example Basic Methods Timing: 30 minutes.
Software Systems Verification and Validation Laboratory Assignment 3
System/Software Testing
Paul Ammann & Jeff Offutt
CS4311 Spring 2011 Unit Testing Dr. Guoqiang Hu Department of Computer Science UTEP.
© Andrew IrelandSoftware Design F28SD2 Software Design (F28SD2): Life-Cycle Perspective - Part 2 Andrew Ireland School of Mathematical & Computer Sciences.
Path Testing + Coverage Chapter 9 Assigned reading from Binder.
Agenda Introduction Overview of White-box testing Basis path testing
1 Software Testing. 2 Path Testing 3 Structural Testing Also known as glass box, structural, clear box and white box testing. A software testing technique.
Testing CSE 331. Ariane 5 rocket The rocket self-destructed 37 seconds after launch Reason: A control software bug that went undetected Conversion from.
CSE403 Software Engineering Autumn 2001 More Testing Gary Kimura Lecture #10 October 22, 2001.
Unit Testing 101 Black Box v. White Box. Definition of V&V Verification - is the product correct Validation - is it the correct product.
INTRUDUCTION TO SOFTWARE TESTING TECHNIQUES BY PRADEEP I.
White-box Testing.
Testing. Real Programmers need no Testing! The Top Five List 5) I want to get this done fast, testing is going to slow me down. 4) I started programming.
1 Program Testing (Lecture 14) Prof. R. Mall Dept. of CSE, IIT, Kharagpur.
Software Engineering Saeed Akhtar The University of Lahore.
Software Construction Lecture 19 Software Testing-2.
SOFTWARE TESTING. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves any activity.
Agent program is the one part(class)of Othello program. How many test cases do you have to test? Reversi [Othello]
CS412/413 Introduction to Compilers Radu Rugina Lecture 18: Control Flow Graphs 29 Feb 02.
1 Control Flow Graphs. 2 Optimizations Code transformations to improve program –Mainly: improve execution time –Also: reduce program size Can be done.
Week 5-6 MondayTuesdayWednesdayThursdayFriday Testing III No reading Group meetings Testing IVSection ZFR due ZFR demos Progress report due Readings out.
1 Graph Coverage (3). Reading Assignment P. Ammann and J. Offutt “Introduction to Software Testing” ◦ Section 2.2 ◦ Section
Dynamic Testing.
Week 6 MondayTuesdayWednesdayThursdayFriday Testing III Reading due Group meetings Testing IVSection ZFR due ZFR demos Progress report due Readings out.
Dynamic White-Box Testing What is code coverage? What are the different types of code coverage? How to derive test cases from control flows?
Control Structure  What is control Structure?  Types of Controls  Use the control structure in VBScript.  Example Summery.
White-Box Testing Statement coverage Branch coverage Path coverage
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
Verification vs. Validation Verification: "Are we building the product right?" The software should conform to its specification.The software should conform.
Testing It is much better to have a plan when testing your programs than it is to just randomly try values in a haphazard fashion. Testing Strategies:
Testing (final thoughts). equals() and hashCode() Important when using Hash-based containers class Duration { public final int min; public final int sec;
1 Software Testing. 2 What is Software Testing ? Testing is a verification and validation activity that is performed by executing program code.
PREPARED BY G.VIJAYA KUMAR ASST.PROFESSOR
CSE373: Data Structures & Algorithms
Software Testing.
White-Box Testing Pfleeger, S. Software Engineering Theory and Practice 2nd Edition. Prentice Hall, Ghezzi, C. et al., Fundamentals of Software Engineering.
Software Testing.
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 4 Control Flow Testing
Software Engineering (CSI 321)
CompSci 230 Software Construction
Paul Ammann & Jeff Offutt
Structural testing, Path Testing
White-Box Testing Techniques
WHITEBOX TESTING APPROACH
Types of Testing Visit to more Learning Resources.
White-Box Testing.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Testing, conclusion Based on material by Michael Ernst, University of Washington.
Software Testing (Lecture 11-a)
Graph Coverage for Source Code
CSE403 Software Engineering Autumn 2000 More Testing
Whitebox Testing.
White-Box Testing.
Paul Ammann & Jeff Offutt
Whitebox Testing.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Software Testing.
Unit III – Chapter 3 Path Testing.
Presentation transcript:

Week 5-6 MondayTuesdayWednesdayThursdayFriday Testing I No reading Group meetings MidtermNo Section Testing II Progress report due Readings out Testing III Readings due Group meetings TBASection ZFR due ZFR demos CSE403 ● Software engineering ● sp12 CSE403 Sp121 White box: slides and a demo

Today: white box testing (  clear box  transparent box  glass box) Goals –Ensure test suite covers (executes) all of the program –Measure quality of test suite with % coverage Assumption –High coverage  few mistakes in the program –Assumes test produce expected output Focus: features not described by specification –Control-flow details –Performance optimizations CSE403 Sp122

White-box motivation Some pieces of code are hard to test fully without knowing the code boolean[] primeTable = new boolean[CACHE_SIZE]; boolean isPrime(int x) { if (x>CACHE_SIZE) { for (int i=2; i<x/2; i++) { if (x%i==0) return false; } return true; } else { return primeTable[x]; } } Important transition around x = CACHE_SIZE that would be hard to guess at since CACHE_SIZE is hidden from the interface CSE403 Sp123

White Box Testing: Advantages Finds an important class of boundaries –Yields useful test cases Consider CACHE_SIZE in isPrime example –Need to check numbers on each side of CACHE_SIZE CACHE_SIZE-1, CACHE_SIZE, CACHE_SIZE+1 –If CACHE_SIZE is mutable, may need to test with different CACHE_SIZE s Disadvantages? –Tests may have same bugs as implementation –What’s a statement? CSE403 Sp124

What is full coverage? static int min (int a, int b) { int r = a; if (a <= b) { r = a; } return r; } Consider any test with a ≤ b (e.g., min(1,2) ) –It executes every instruction –It misses the bug Statement coverage is not enough CSE403 Sp125

Edge coverage Another approach is to use a control flow graph (CFG) representation of a program –Essentially, a flowchart Then ensure that the suite covers all edges in the CFG CSE403 Sp126 static int min (int a, int b) { int r = a; if (a <= b) { r = a; } return r; } r = a a <= b r = a

UW CSE 4037 Condition coverage Complex conditions can confound edge coverage –if (p != NULL) and (p->left right) … Is this a single conditional statement in the CFG? How are short-circuit conditionals handled? –andthen, orelse

Path coverage Edge coverage is in some sense very static Edges can be covered without covering paths (sequences of edges) –These better model the actual execution UW CSE 4038

CSE403 Sp129 if (x != 0){ y = 5 } else z = z-x } if (z > 1) { z = z/x } else { z = 0 } x != 0 z > 1 y = 5z = z-x z = z/xz = 0 T1: {x=1,z=2}T2: {x=0,z=-2}

UW CSE Example

UW CSE Path coverage and loops In general, we can’t bound the number of times a loop executes So there are an unbounded number of paths in general Often in practice –Clear boundary conditions –10

Varieties of coverage Statement coverage Branch coverage Decision coverage Loop coverage Condition/Decision coverage Path coverage increasing number of test cases CSE403 Sp1212

Limitations of coverage 100% coverage is not always a reasonable target 100% may be unattainable (dead code) High cost to approach the limit Coverage is just a heuristic Oracles – “does it do the right thing?” – are often neglected in the face of coverage High-coverage can be a counter-intuitive indicator of poor code CSE403 Sp1213

How to increase coverage? Another limitation is that, beyond simple examples, it is often hard to figure out how to increase coverage – that is, what tests should be added to cover a particular statement or edge or path or such? How might you do this? CSE403 Sp1214

Week 5-6 MondayTuesdayWednesdayThursdayFriday Testing I No reading Group meetings MidtermNo Section Testing II Progress report due Readings out Testing III Readings due Group meetings TBASection ZFR due ZFR demos CSE403 ● Software engineering ● sp12 CSE403 Sp1215