Http://flic.kr/p/ohtmj Whitebox Testing.

Slides:



Advertisements
Similar presentations
Decision Structures - If / Else If / Else. Decisions Often we need to make decisions based on information that we receive. Often we need to make decisions.
Advertisements

Chapter 14 Software Testing Techniques - Testing fundamentals - White-box testing - Black-box testing - Object-oriented testing methods (Source: Pressman,
Software Testing. Quality is Hard to Pin Down Concise, clear definition is elusive Not easily quantifiable Many things to many people You'll know it when.
Chapter 6 Path Testing Software Testing
Whitebox Testing Fra: CS Fall Whitebox Testing AKA Structural, Basis Path Test Normally used at unit level Assumes errors at unit level are.
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
Nov R McFadyen1 A Traditional Software Development Process Unit test Integration test System test Detailed design Architectural design Analysis.
White Box Testing and Symbolic Execution Written by Michael Beder.
White Box Testing Techniques Dynamic Testing. White box testing(1) Source code is known and used for test design While executing the test cases, the internal.
Claus Brabrand, ITU, Denmark Feb 17, 2009WHITE-BOX TESTING White-Box Testing Claus Brabrand [ ] ( “FÅP”: First-year Project Course, ITU,
Software Testing and Quality Assurance
Department of Informatics, UC Irvine SDCL Collaboration Laboratory Software Design and sdcl.ics.uci.edu 1 Informatics 43 Introduction to Software Engineering.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
System/Software Testing
White-Box Testing Eshcar Hillel Michael Beder. White Box Testing 2 Tutorial Outline What is White Box Testing? Flow Graph and Coverage Types Symbolic.
CS4311 Spring 2011 Unit Testing Dr. Guoqiang Hu Department of Computer Science UTEP.
Overview of Software Testing 07/12/2013 WISTPC 2013 Peter Clarke.
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.
Unit Testing 101 Black Box v. White Box. Definition of V&V Verification - is the product correct Validation - is it the correct product.
White-box Testing.
CS 217 Software Verification and Validation Week 7, Summer 2014 Instructor: Dong Si
Coverage Estimating the quality of a test suite. 2 Code Coverage A code coverage model calls out the parts of an implementation that must be exercised.
1 Phase Testing. Janice Regan, For each group of units Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine.
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.
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 ‏ Control Structures.
1 Program Testing (Lecture 14) Prof. R. Mall Dept. of CSE, IIT, Kharagpur.
Java Basics Hussein Suleman March 2007 UCT Department of Computer Science Computer Science 1015F.
1 Control Flow Analysis Topic today Representation and Analysis Paper (Sections 1, 2) For next class: Read Representation and Analysis Paper (Section 3)
White Box Testing Arun Lakhotia University of Southwestern Louisiana P.O. Box Lafayette, LA 70504, USA
Software Construction Lecture 19 Software Testing-2.
Department of Informatics, UC Irvine SDCL Collaboration Laboratory Software Design and sdcl.ics.uci.edu 1 Informatics 43 Introduction to Software Engineering.
Theory and Practice of Software Testing
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]
Dynamic Testing.
SOFTWARE TESTING. SOFTWARE Software is not the collection of programs but also all associated documentation and configuration data which is need to make.
Dynamic White-Box Testing What is code coverage? What are the different types of code coverage? How to derive test cases from control flows?
Conditional Statements A conditional statement lets us choose which statement will be executed next Conditional statements give us the power to make basic.
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.
CS223: Software Engineering Lecture 26: Software Testing.
1 Software Testing. 2 What is Software Testing ? Testing is a verification and validation activity that is performed by executing program code.
White Box Testing. Agenda White-box vs Black-box Program Flow Controls White-box Test Methods Exercises Complexity Q&A.
Debugging and Testing Hussein Suleman March 2007 UCT Department of Computer Science Computer Science 1015F.
Week 5-6 MondayTuesdayWednesdayThursdayFriday Testing I No reading Group meetings MidtermNo Section Testing II Progress report due Readings out Testing.
Software Testing.
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)
Software Testing.
Structural testing, Path Testing
WHITEBOX TESTING APPROACH
Types of Testing Visit to more Learning Resources.
White-Box Testing.
Testing Approaches.
White-Box Testing.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Software Testing (Lecture 11-a)
White-Box Testing.
Whitebox Testing.
White-Box Testing.
CSE 1020:Software Development
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Software Testing.
Unit III – Chapter 3 Path Testing.
Presentation transcript:

http://flic.kr/p/ohtmj Whitebox Testing

SWEBOK Knowledge Areas Software Requirements Software Design Software Construction Software Testing Software Maintenance Software Configuration Management Software Engineering Management Software Engineering Process Software Engineering Models and Methods Software Quality Software Engineering Professional Practice Software Engineering Economics Computing Foundations Mathematical Foundations Engineering Foundations Today’s topic

Recall: Common approaches for choosing test cases Blackbox testing: Choose based on module’s possible inputs and outputs Do not use code Often test boundary cases White-box testing: Uses internal logic to choose tests Different levels of code coverage Aka glass box testing, clear box testing Regression testing: Keep tests that reveal old bugs Rationale: “Fixed” bugs come back!

Criteria for choosing test cases: Coverage Measures Degree to which the source code of a program is tested by a test suite Examples: Statement coverage Condition coverage Path coverage Some examples will clarify, but first…

Control Flow Graphs – Frequently used to calculate coverage int foo(int x, int y) { int z = 0; if ((x>0) && (y>0)) { z = x; } return z; Basic blocks: straight-line pieces of code without any jumps or jump targets return z; z = x; int z = 0; if ((x>0) && (y>0)) { true false Jumps: control branches

Statement Coverage Set of test cases such that… Each program statement (line or basic block) is executed at least once

Define a test suite that provides statement coverage for this code return z; z = x; int z = 0; if ((x>0) && (y>0)) { true false Control Flow Graph int foo(int x, int y) { int z = 0; if ((x>0) && (y>0)) { z = x; } return z; ✔ ✔ input expected x y ✔ 1

Now try this code… Control Flow Graph F T T F T F public int bar(int x) { int result=0; if (x < 69) { if (x % 2 == 0) { result = x/2; } else { result = x*2; } } else if (x > 6969) { x = 69; x = 6969; return result; Control Flow Graph int result=0; result = x*2; F T x < 69 x % 2 == 0 T F result = x/2; T x > 6969 x = 69; F return result; x = 6969;

✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ Now try this code… Input (x) expected 1 2 2 1 6970 Control Flow Graph 70 6969 ✔ ✔ int result=0; result = x*2; ✔ ✔ F T x < 69 x % 2 == 0 T ✔ F result = x/2; ✔ ✔ T x > 6969 x = 69; ✔ F return result; ✔ x = 6969;

Condition Coverage Set of test cases such that… Each boolean expression (in control structures) evaluates to true at least once and to false at least once

✔ ✔ Define a test suite that provides condition coverage for this code return z; z = x; int z = 0; if ((x>0) && (y>0)) { true false Control Flow Graph int foo(int x, int y) { int z = 0; if ((x>0) && (y>0)) { z = x; } return z; ✔ ✔ input expected x y 1

Now try this code… Control Flow Graph F T T F T F public int bar(int x) { int result=0; if (x < 69) { if (x % 2 == 0) { result = x/2; } else { result = x*2; } } else if (x > 6969) { x = 69; x = 6969; return result; Control Flow Graph int result=0; result = x*2; F T x < 69 x % 2 == 0 T F result = x/2; T x > 6969 x = 69; F return result; x = 6969;

✔ ✔ ✔ ✔ ✔ ✔ Now try this code… Input (x) expected 1 2 2 1 6970 69 Control Flow Graph 70 6969 int result=0; result = x*2; ✔ ✔ F T x < 69 x % 2 == 0 ✔ T ✔ F result = x/2; ✔ T x > 6969 x = 69; ✔ F return result; x = 6969;

Path Coverage Set of test cases such that… Each possible path through a program’s control flow graph is taken at least once

✔ ✔ Define a test suite that provides path coverage for this code return z; z = x; int z = 0; if ((x>0) && (y>0)) { true false Control Flow Graph int foo(int x, int y) { int z = 0; if ((x>0) && (y>0)) { z = x; } return z; (a) (b) (c) input expected x y 1 Paths: a , b c ✔ ✔

Now try this code… Control Flow Graph F T T F T F public int bar(int x) { int result=0; if (x < 69) { if (x % 2 == 0) { result = x/2; } else { result = x*2; } } else if (x > 6969) { x = 69; x = 6969; return result; Control Flow Graph int result=0; result = x*2; F T x < 69 x % 2 == 0 T F result = x/2; T x > 6969 x = 69; F return result; x = 6969;

✔ ✔ ✔ ✔ Now try this code… Input (x) expected 1 2 2 1 6970 69 70 6969 Control Flow Graph int result=0; (a) (b) (c) (d) (f) (e) (g) (h) (i) (j) (k) result = x*2; F T x < 69 Paths: a , d , f , h a , d , g , i a , b , e , j a , b , c , k x % 2 == 0 ✔ T ✔ F result = x/2; ✔ ✔ T x > 6969 x = 69; F return result; x = 6969;

BONUS QUESTION

Draw a control flow graph Define test suites that provide: Given this code Draw a control flow graph Define test suites that provide: Statement coverage Condition coverage Path coverage int myF(int x, int y) { while (x > 10) { x = x – 10; if (x == 10) { break; } if (y < 20 && x%2 == 0) { y = y + 20; } else { y = y – 20; return 2*x + y;

Here’s the CFG F T F T F T int myF(int x, int y) { while (x > 10) { x = x – 10; if (x == 10) { break; } if (y < 20 && x%2 == 0) { y = y + 20; } else { y = y – 20; return 2*x + y; while (x > 10) F T x = x – 10; if (x == 10) F T break; if (y < 20 && x%2 == 0) F T y = y – 20; y = y + 20; Here’s the CFG return 2*x + y;