-- Finishing Design Unit -- Intro to Glass Box Testing ECEN5543 / CSCI 5548 SW Eng of Standalone Programs University of Colorado, Boulder.

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.
Defect testing Objectives
White Box and Black Box Testing Tor Stålhane. What is White Box testing White box testing is testing where we use the info available from the code of.
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
CMSC 345, Version 11/07 SD Vick from S. Mitchell Software Testing.
Detailed Design Kenneth M. Anderson Lecture 21
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.
Fall, 2006SW Eng Standalone Progs, Univ of Colorado Boulder 1 Wk 11 Glass Box Testing, Flow Graphs, Test Coverage SW Engineering of Standalone Programs.
IMSE Week 18 White Box or Structural Testing Reading:Sommerville (4th edition) ch 22 orPressman (4th edition) ch 16.
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
BASIS PATH TESTING ● By Tom McCabe ● McCabe, T., "A Software Complexity Measure," IEEE Trans. Software Engineering, vol. SE-2, December 1976, pp
Testing an individual module
Chapter 18 Testing Conventional Applications
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
Unit Testing CS 414 – Software Engineering I Don Bagert Rose-Hulman Institute of Technology January 16, 2003.
SOFTWARE TESTING WHITE BOX TESTING 1. GLASS BOX/WHITE BOX TESTING 2.
1 Software Testing Techniques CIS 375 Bruce R. Maxim UM-Dearborn.
Chapter 13 & 14 Software Testing Strategies and Techniques
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
Software Systems Verification and Validation Laboratory Assignment 3
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
CMSC 345 Fall 2000 Unit Testing. The testing process.
Prof. Mohamed Batouche Software Testing.
CS4311 Spring 2011 Unit Testing Dr. Guoqiang Hu Department of Computer Science UTEP.
Chapter 13: Implementation Phase 13.3 Good Programming Practice 13.6 Module Test Case Selection 13.7 Black-Box Module-Testing Techniques 13.8 Glass-Box.
1 Software testing. 2 Testing Objectives Testing is a process of executing a program with the intent of finding an error. A good test case is in that.
Agenda Introduction Overview of White-box testing Basis path testing
Test Coverage CS-300 Fall 2005 Supreeth Venkataraman.
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.
Software Testing and Reliability Southern Methodist University CSE 7314.
1 Phase Testing. Janice Regan, For each group of units Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine.
1 Program Testing (Lecture 14) Prof. R. Mall Dept. of CSE, IIT, Kharagpur.
Software Engineering1  Verification: The software should conform to its specification  Validation: The software should do what the user really requires.
White Box Testing Arun Lakhotia University of Southwestern Louisiana P.O. Box Lafayette, LA 70504, USA
Software Construction Lecture 19 Software Testing-2.
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.
White Box Testing by : Andika Bayu H.
Cyclomatic complexity (or conditional complexity) is a software metric (measurement). Its gives the number of indepented paths through strongly connected.
These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill 2009). Slides copyright 2009 by Roger Pressman.1.
SOFTWARE TESTING. SOFTWARE Software is not the collection of programs but also all associated documentation and configuration data which is need to make.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
ANOOP GANGWAR 5 TH SEM SOFTWARE TESTING MASTER OF COMPUTER APPLICATION-V Sem.
Verification vs. Validation Verification: "Are we building the product right?" The software should conform to its specification.The software should conform.
Software Testing. SE, Testing, Hans van Vliet, © Nasty question  Suppose you are being asked to lead the team to test the software that controls.
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.
Software TestIng White box testing.
Software Testing.
Rekayasa Perangkat Lunak Part-13
Software Testing.
Software Testing Techniques
Software Engineering (CSI 321)
Chapter 13 & 14 Software Testing Strategies and Techniques
Structural testing, Path Testing
White-Box Testing Techniques
Types of Testing Visit to more Learning Resources.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Software Testing (Lecture 11-a)
Chapter 14 Software Testing Techniques
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
White-Box Testing Techniques I
Control Structure Testing
Software Testing “If you can’t test it, you can’t design it”
© Healthcare Inspirations. All rights reserved
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Chapter 13 & 14 Software Testing Strategies and Techniques 1 Software Engineering: A Practitioner’s Approach, 6th edition by Roger S. Pressman.
Presentation transcript:

-- Finishing Design Unit -- Intro to Glass Box Testing ECEN5543 / CSCI 5548 SW Eng of Standalone Programs University of Colorado, Boulder

Many Examples Pure Fabrication – an idea to group together some common behavior Many OO design patterns are examples Adapter Strategy Command... Traditional cohesion – top two strongest informational functional

Introduction to Glass Box Testing Testing Software Engineering of Standalone Programs

What is Glass Box Testing? Sometimes called Structure Tests Exercise the internal logic of a program and traverse particular execution paths (Functional, performance, and stress testing are collectively referred to as black box testing.)

What are major activities? Decide which paths need to be exercised. Derive test data to exercise those paths. Determine the test coverage criterion. Execute the test cases. Measure the test coverage achieved.

Why determine test coverage criterion? Why not just test it all? What does “all” mean? Program units (classes, clusters of classes) usually contain too many paths to permit exhaustive testing. For example, loops introduce combinatorial numbers of execution paths and make exhaustive testing impossible.

What if you could test all paths? Would the program be correct then? The program might be missing paths Code for branch alternative not there More likely detect missing paths how? Might have computational errors not revealed in the test data shown, even on the path where the error occurs We call that coincidental correctness For example, suppose code has x = A + A where it should have A*A but you test with A = 2.

When are you done with unit testing? Decide on criterion Statement coverage Branch coverage Logical path coverage

Statement Coverage Find a set of test cases to ensure that every statement is executed at least once

Branch coverage Find a set of test cases to ensure that each branching statement is taken in each direction at least once How is that different from statement coverage?

Logical Path Coverage Acknowledges that the order in which branches are taken can be significant Ensure that every path is executed at least once A path is some feasible combination of statements and branches Not in your life time...

Branch Testing -- May not accomplish what you think Consider the following pseudocode: if (X > 3 and then Y = 2) then Z := 1 endif; if (X = 4 or else Z > 3) then Z := Z + 1; endif; What happens with test case x=5, y=2, z=3 and x=4, y=3, z=3?

Common rule of thumb re unit test completion 85 to 90 % of branch coverage that is, 85 to 90% of all branch alternatives have been traversed by the set of unit test cases. Strikes a balance between excessive number of test cases and leaving test completion to the intuition of each programmer According to studies, functional + performance + stress tests based on functional requirements and programmer’s intuition achieve....

Limitations May not be possible to reach 100% branch coverage because it may be hard to find input data that will exercise a nested branching statement in a particular way. Beware of trend plots # errors discovered per unit of time vs. time Expect buildup to maximum value and then trail off Problems with this?

Control Flow Diagrams Provide visual representation of flow of control IF While For “Do until” Case

Control flow examples - 1

Control flow examples - 2

Control flow examples - 3

Control flow examples - 4

Why look at control flow? Easy to spot complexity Easy to develop basis set for statement coverage

Complexity leads to faults What do you find makes code hard to understand? What does the control flow diagram look like for that? McCabe’s Cyclomatic Complexity What is being measured? Number of branches Number of closed regions What is NOT being measured? Beware: you can analyze YOUR error data against your modules and determine what characteristics are fault-prone in your application area.

Basis set for statement coverage testing Draw the flow graph Count the regions including the “outside” N is the number of linearly independent paths through the program control structure A linearly independent path includes one node of the control flow graph not contained in any other Create a basis set of linearly independent paths Prepare test cases to force execution of each path in the basis set. Execution of these test cases yields ______ coverage

Code sample /* Copyright (c) 1995 Sun Microsystems, Inc. All Rights Reserved. * Permission to use, copy, modify, and distribute this software and its documentation for * NON-COMMERCIAL purposes and without fee is hereby granted provided that this * copyright notice appears in all copies. Please refer to the file “copyright.html” for * further important copyright and licensing information.

* SUN MAKES NO REPRESENTATION OR WARRANTIES ABOUT THE * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON- * INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES * SUFFERED BY LINCENSEE AS A RESULT OF USING, MODIFYING OR * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.

import java.io.*; import java.util.vector; class ListOfNumbers { private Vector victor; final int size = 10; public ListOfNumbers () { int i; victor = new Vector(size); for (i = 0; i < size; i++) victor.addElement(new Interger(i)); }

public void writeList() { PrintStream pStr = null; System.out.println(“Entering try statement”); int i; pStr = new PrintStream( new BufferedOutputStream( new FileOutputStream(“OutFile.txt”))); for (i = 0; i < size; i++) pStr.println(“Value at: “ + i + “ = “ + victor.elementAt(i)); pStr.close() }