Control Flow Testing

Similar documents
Test case design techniques I: Whitebox testing CISS

Test Case Design Techniques

Test case design techniques I: Whitebox testing CISS

Efficient Data Structures for Decision Diagrams

Different Approaches to White Box Testing Technique for Finding Errors

Introduction to Computers and Programming. Testing

Introduction to Software Testing Chapter 8.1 Building Testing Tools Instrumentation. Chapter 8 Outline

Software Testing Strategies and Techniques

Using Eclipse CDT/PTP for Static Analysis

Automatic Test Data Synthesis using UML Sequence Diagrams

Dataflow approach to testing Java programs supported with DFC

Instrumentation Software Profiling

Optimizations. Optimization Safety. Optimization Safety. Control Flow Graphs. Code transformations to improve program

SQL Query Evaluation. Winter Lecture 23

Model-Driven Development - From Frontend to Code

ID TECH UniMag Android SDK User Manual

Elena Baralis, Silvia Chiusano Politecnico di Torino. Pag. 1. Active database systems. Triggers. Triggers. Active database systems.

Laboratory Project for a Software Quality Class

Standard for Software Component Testing

Software Testing. Motivation. People are not perfect We make errors in design and code

Chapter 5. Regression Testing of Web-Components

National University of Ireland, Maynooth MAYNOOTH, CO. KILDARE, IRELAND. Testing Guidelines for Student Projects

CSE 880. Advanced Database Systems. Active Database Design Issues

Development Environment and Tools for Java. Brian Hughes IBM

Change Impact Analysis

CS 2112 Spring Instructions. Assignment 3 Data Structures and Web Filtering. 0.1 Grading. 0.2 Partners. 0.3 Restrictions

GameTime: A Toolkit for Timing Analysis of Software

What is a Loop? Pretest Loops in C++ Types of Loop Testing. Count-controlled loops. Loops can be...

Software Pipelining - Modulo Scheduling

Database Programming with PL/SQL: Learning Objectives

Keywords: Regression testing, database applications, and impact analysis. Abstract. 1 Introduction

TeCReVis: A Tool for Test Coverage and Test Redundancy Visualization

How To Trace

Software Quality Exercise 2

Series and Parallel Resistive Circuits

Generating Automated Test Scripts for AltioLive using QF Test

Certification Authorities Software Team (CAST) Position Paper CAST-10

Why? A central concept in Computer Science. Algorithms are ubiquitous.

EVALUATION. WA1844 WebSphere Process Server 7.0 Programming Using WebSphere Integration COPY. Developer

Java Application Developer Certificate Program Competencies

Basics of VTune Performance Analyzer. Intel Software College. Objectives. VTune Performance Analyzer. Agenda

Towards a Framework for Generating Tests to Satisfy Complex Code Coverage in Java Pathfinder

COREsim Transcript Data Format

Software Metrics in Static Program Analysis

Regression Verification: Status Report

PAPER Variable Data-Flow Graph for Lightweight Program Slicing and Visualization

Chapter 8: Bags and Sets

Static Analysis. Find the Bug! : Analysis of Software Artifacts. Jonathan Aldrich. disable interrupts. ERROR: returning with interrupts disabled

The first program: Little Crab

Structured Testing: A Testing Methodology Using the Cyclomatic Complexity Metric

Lab work Software Testing

Unit-testing with JML

EVALUATING METRICS AT CLASS AND METHOD LEVEL FOR JAVA PROGRAMS USING KNOWLEDGE BASED SYSTEMS

Scoping (Readings 7.1,7.4,7.6) Parameter passing methods (7.5) Building symbol tables (7.6)

Trace-Based and Sample-Based Profiling in Rational Application Developer

Circuits 1 M H Miller

LabVIEW DSP Test Integration Toolkit for TI DSP

IBM InfoSphere MDM Server v9.0. Version: Demo. Page <<1/11>>

SYSM 6304: Risk and Decision Analysis Lecture 5: Methods of Risk Analysis

World Programming System provides system performance monitoring and reporting, and supports end-user applications and reporting

ISSN: (Online) Volume 4, Issue 2, February 2016 International Journal of Advance Research in Computer Science and Management Studies

Chap 4. Using Metrics To Manage Software Risks

50% task time estimate A task time estimate that has a 50% probability of being achieved.

Five TCs branch cov. statement cov [0.5] screenshot branch. 15 TCs EclEmma screenshot cov. Five TCs report. cov [0.5] [0.5] [0.

2 The first program: Little Crab

Profiling and Testing with Test and Performance Tools Platform (TPTP)

Genetic Algorithm Based Test Data Generator

Exam Name: IBM InfoSphere MDM Server v9.0

- User input includes typing on the keyboard, clicking of a mouse, tapping or swiping a touch screen device, etc.


Unit Testing & JUnit

Euler Paths and Euler Circuits

Industrial Adoption of Automatically Extracted GUI Models for Testing

Native code in Android Quad Detection

Database Application Developer Tools Using Static Analysis and Dynamic Profiling

While Loop. 6. Iteration

Automated Model Based Testing for an Web Applications

1 Description of The Simpletron

Core - The Contextual Role Editor

Static Program Transformations for Efficient Software Model Checking

Top Weblogic Tasks You can Automate Now

Table of Contents. P a g e 2

Review; questions Discussion of Semester Project Arbitrary interprocedural control flow Assign (see Schedule for links)

Magnetic Fields. I. Magnetic Field and Magnetic Field Lines

Objective. Materials. TI-73 Calculator

Optimal Binary Search Trees Meet Object Oriented Programming

Basis Path Test Suite and Testing Process for WS-BPEL

Parameter Passing in Pascal

Tool-Assisted Unit-Test Generation and Selection Based on Operational Abstractions

Reinforcement Learning

Compiler Construction

GENERIC and GIMPLE: A New Tree Representation for Entire Functions

DAVE Usage with SVN. Presentation and Tutorial v 2.0. May, 2014

Lecture 2 Introduction to Data Flow Analysis

Elena Baralis, Silvia Chiusano Politecnico di Torino. Pag. 1. Physical Design. Phases of database design. Physical design: Inputs.

Test Coverage and Risk

CS 451 Software Engineering Winter 2009

Logistics. Software Testing. Logistics. Logistics. Plan for this week. Before we begin. Project. Final exam. Questions?

Basics of STATA. 1 Data les. 2 Loading data into STATA

Test case design techniques II: Blackbox testing CISS

Transcription:

Control low esting

Structural esting In structural testing, the software is viewed as a white box and test cases are determined from the implementation of the software. Structural testing techniques include control flow testing and data flow testing.

Control low esting Control flow testing uses the control structure of a program to develop the test cases for the program. he test cases are developed to sufficiently cover the whole control structure of the program. he control structure of a program can be represented by the control flow graph of the program.

Control low Graph he control flow graph G = (N, E) of a program consists of a set of nodes N and a set of edge E. Each node represents a set of program statements. here are five types of nodes. here is a unique entry node and a unique exit node. here is an edge from node n 1 to node n 2 if the control may flow from the last statement in n 1 to the first statement in n 2.

Control low Graph: Nodes A decision node contains a conditional statement that creates 2 or more control branches (e.g. if or switch statements). A merge node usually does not contain any statement and is used to represent a program point where multiple control branches merge. A statement node contains a sequence of statements. he control must enter from the first statement and exit from the last statement.

Control low Graph: An Example int evensum(int i) { int sum = 0; entry sum = 0; i <= 10 return sum; while (i <= 10) { if (i/2 == 0) sum = sum + i; i++; } return sum; i/2 == 0 sum = sum + i; i++; exit }

est Cases A test case is a complete path from the entry node to the exit node of a control flow graph. A test coverage criterion measures the extent to which a set of test cases covers a program.

est Coverage Criteria Statement coverage (SC) Decision coverage (DC) Condition coverage (CC) Decision/condition coverage (D/CC) Multiple condition coverage (MCC) Path coverage (PC) Node coverage Edge coverage

Statement Coverage Every statement in the program has been executed at least once. entry sum = 0; 2 3 1 i <= 10 i/2 == 0 sum = sum + i; 4 exit 8 return sum; 1 2 3 4 5 6 7 2 8 5 i++; 7 6

Decision Coverage Every statement in the program has been executed at least once, and every decision in the program has taken all possible outcomes at least once. entry 1 2 3 5 6 7 2 3 4 5 6 7 2 8 sum = 0; i <= 10 5 7 2 6 1 3 i/2 == 0 sum = sum + i; i++; 4 return sum; exit 8

Decision Coverage d = (A B) C combination value DC CC D/CC MCC number A B C d 1 1 1 1 1 1 2 1 1 0 1 1 3 1 0 1 1 1 4 0 1 1 1 1 5 1 0 0 0 2 6 0 1 0 0 2 7 0 0 1 1 1 8 0 0 0 0 2

Condition Coverage Every statement in the program has been executed at least once, and every condition in each decision has taken all possible outcomes at least once.

Condition Coverage d = (A B) C combination value DC CC D/CC MCC number A B C d 1 1 1 1 1 1 1 1 2 1 1 0 1 1 1 2 3 1 0 1 1 1 1 3 4 0 1 1 1 1 1 4 5 1 0 0 0 2 2 4 6 0 1 0 0 2 2 3 7 0 0 1 1 1 2 2 8 0 0 0 0 2 2 1

Decision/Condition Coverage Every statement in the program has been executed at least once, every decision in the program has taken all possible outcomes at least once, and every condition in each decision has taken all possible outcomes at least once.

Decision/Condition Coverage d = (A B) C combination value DC CC D/CC MCC number A B C d 1 1 1 1 1 1 1 1 1 1 2 1 1 0 1 1 1 2 3 1 0 1 1 1 1 3 1 2 4 0 1 1 1 1 1 4 1 3 5 1 0 0 0 2 2 4 2 3 6 0 1 0 0 2 2 3 2 2 7 0 0 1 1 1 2 2 8 0 0 0 0 2 2 1 2 1

Multiple Condition Coverage Every statement in the program has been executed at least once, all possible combination of condition outcomes in each decision has been invoked at least once. here are 2 n combinations of condition outcomes in a decision with n conditions.

Multiple Condition Coverage d = (A B) C combination value DC CC D/CC MCC number A B C d 1 1 1 1 1 1 1 1 1 1 2 1 1 0 1 1 1 2 2 3 1 0 1 1 1 1 3 1 2 3 4 0 1 1 1 1 1 4 1 3 4 5 1 0 0 0 2 2 4 2 3 5 6 0 1 0 0 2 2 3 2 2 6 7 0 0 1 1 1 2 2 7 8 0 0 0 0 2 2 1 2 1 8

Path Coverage Every complete path in the program has been executed at least once. A loop usually has an infinite number of complete paths.

est Coverage Criteria Hierarchy path coverage multiple condition coverage decision/condition coverage decision coverage condition coverage statement coverage

esting Simple Loops Skip the loop entirely Go once through the loop Go twice through the loop If the loop has max passes = n, then go n 1, n, and n + 1 times through the loop

esting Nested Loops Set all outer loops to their minimal value and test the innermost loop Add tests of out-of-range values Work outward, at each stage holding all outer loops at their minimal value Continue until all loops are tested

Java Code Coverage ool EclEmma is a free Java code coverage tool for Eclipse http://www.eclemma.org EclEmma adopts the philosophy of the EMMA Java code coverage tool for the Eclipse workbench http://emme.sourceforge.net

EclEmma ast develop/test cycle: Launches from within the workbench like JUnit and test runs can directly be analyzed for code coverage. Rich coverage analysis: Coverage results are immediately summarized and highlighted in the Java source code editors. Non-invasive: EclEmma does not require modifying your projects or performing any other setup.

Path Selection It is better to take many simple paths than a few complicated ones. here is no harm in taking paths that will exercise the same code more than once. Select paths as small variations of previous paths. ry to change one thing in each path at a time.

An Example 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 2 4 1 2 8 3 4 9 10 6 7 2 4 8 10 1 2 8 9 10 5 6 7 2 8 10

An Example 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 2 4 1 2 3 4 9 10 5 6 7 2 4 10 1 2 3 4 9 10 6 7 2 4 10 1 2 8 3 4 9 10 6 7 2 4 8 10 1 2 8 9 10 6 7 2 8 10

An Example: Usage Information 1 2 3 4 5 6 7 : 0.8 : 0.2 8 9 10 1 2 3 4 9 10 6 7 2 4 10 1 2 3 4 9 10 5 6 7 2 4 10 1 2 3 4 5 6 7 2 4 1 2 8 3 4 9 10 6 7 2 4 8 10 1 2 8 9 10 6 7 2 8 10

Path Predicate Expression A complete path may contain a succession of decisions. An input vector is a tuple of values corresponding to the vector of input variables. A path predicate expression is a Boolean expression that characterizes the set of input vectors that will cause a complete path to be traversed.

An Example entry sum = 0; 2 3 1 i <= 10 i/2 == 0 sum = sum + i; 4 exit 8 return sum; 1 2 3 4 5 6 7 2 8 { i <= 10, i/2 == 0, i + 1 > 10 } 1 2 3 5 6 7 2 3 4 5 6 7 2 8 5 i++; 7 6 { i <= 10, i/2!= 0, i+1 <= 10, (i+1)/2 == 0, i+2 > 10 }

Path Sensitization Path sensitization is the act of finding a set of solutions to a path predicate expression. If a path predicate expression has a solution, then the corresponding path is achievable; otherwise, the corresponding path is unachievable.

An Example: Correlated Decisions entry sum = 0; 5 7 2 3 6 1 i <= 10 i/2 == 0 sum = sum + i; i++; 4 return sum; exit 8 1 2 3 4 5 6 7 2 8 achievable 1 2 3 5 6 7 2 8 unachievable

est Oracle o verify the execution is correct, we need to compare the actual outcome with the expected outcome. est oracle is a tool that can return the expected outcome for a given input vector. An executable specification of a program can be used as a test oracle for that program.

An Example entry sum = 0; 5 2 3 1 i <= 10 i/2 == 0 sum = sum + i; 4 return sum; exit 8 1 2 3 4 5 6 7 2 8 path sensitization: i = 10 test oracle: sum = 10 i++; 6 7

An Example entry sum = 0; 5 2 3 1 i <= 10 i/2 == 0 sum = sum + i; 4 exit 8 return sum; 1 2 3 5 6 7 2 3 4 5 6 7 2 8 path sensitization: i = 9 test oracle: sum = 10 i++; 6 7