CS223: Software Engineering Lecture 26: Software 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

DATAFLOW TESTING DONE BY A.PRIYA, 08CSEE17, II- M.s.c [C.S].
Data-Flow Analysis II CS 671 March 13, CS 671 – Spring Data-Flow Analysis Gather conservative, approximate information about what a program.
1 CS 201 Compiler Construction Lecture 3 Data Flow Analysis.
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
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.
Software Testing and Quality Assurance
1 CS 201 Compiler Construction Lecture 6 Code Optimizations: Constant Propagation & Folding.
Chapter 18 Testing Conventional Applications
1 KU College of Engineering Elec 204: Digital Systems Design Lecture 20 Datapath and Control Datapath - performs data transfer and processing operations.
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 5 Data Flow Testing
Software Testing and QA Theory and Practice (Chapter 4: Control Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
Software Systems Verification and Validation Laboratory Assignment 3
Topics in Software Dynamic White-box Testing Part 2: Data-flow Testing
Software testing techniques Testing criteria based on data flow
Presented By Dr. Shazzad Hosain Asst. Prof., EECS, NSU
CMSC 345 Fall 2000 Unit Testing. The testing process.
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.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 20 Slide 1 Defect testing l Testing programs to establish the presence of system defects.
Overview of Software Testing 07/12/2013 WISTPC 2013 Peter Clarke.
CS4311 Spring 2011 Unit Testing Dr. Guoqiang Hu Department of Computer Science UTEP.
White-box Testing.
Static Program Analyses of DSP Software Systems Ramakrishnan Venkitaraman and Gopal Gupta.
1 Program Testing (Lecture 14) Prof. R. Mall Dept. of CSE, IIT, Kharagpur.
Algorithmic state machines
Condition Testing. Condition testing is a test case design method that exercises the logical conditions contained in a program module. A simple condition.
1 Software Testing and Quality Assurance Theory and Practice Chapter 6 Domain Testing.
Workshop on Integrating Software Testing into Programming Courses (WISTPC14:2) Friday July 18, 2014 Introduction to Software Testing.
/ PSWLAB Evidence-Based Analysis and Inferring Preconditions for Bug Detection By D. Brand, M. Buss, V. C. Sreedhar published in ICSM 2007.
1 Test Coverage Coverage can be based on: –source code –object code –model –control flow graph –(extended) finite state machines –data flow graph –requirements.
Dynamic White-Box Testing What is code coverage? What are the different types of code coverage? How to derive test cases from control flows?
Introduction to Software Testing. Graph Coverage For Specifications 2 Call graphs for classes often wind up being disconnected, and in many cases, such.
Software Dynamic White-box Testing Part 2: Data-flow Testing Lecture 7 Prof. Mostafa Abdel Aziem Mostafa.
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.
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 and QA Theory and Practice (Chapter 5: Data Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
CS223: Software Engineering
CS223: Software Engineering
Software Testing.
Control Flow Testing Handouts
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 4 Control Flow Testing
Software Engineering (CSI 321)
Condition Testing.
Software Testing and Maintenance 1
CompSci 230 Software Construction
Graph Coverage for Specifications CS 4501 / 6501 Software Testing
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 6 Domain Testing
Outline of the Chapter Basic Idea Outline of Control Flow Testing
CONTROL FLOW TESTING.
Structural testing, Path Testing
Types of Testing Visit to more Learning Resources.
White-Box Testing.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Software Testing (Lecture 11-a)
Graph Coverage for Specifications CS 4501 / 6501 Software Testing
Sudipto Ghosh CS 406 Fall 99 November 16, 1999
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Control Structure Testing
KU College of Engineering Elec 204: Digital Systems Design
Logic Coverage for Source Code CS 4501 / 6501 Software Testing
White-Box Testing.
Whitebox Testing.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Software Testing and QA Theory and Practice (Chapter 5: Data Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
Presentation transcript:

CS223: Software Engineering Lecture 26: Software Testing

Recap Introduction to testing Fault-failure-defect-error White box-black box testing Test report writing

Objective After completing this lecture students will be able to o Perform control flow test of their software

Control Flow Testing Program instructions are executed in a sequential manner o In the absence of conditional statements o Unless a function is called The execution of a sequence of instructions from the entry point to the exit point of a program unit is called a program path. Ideally, one must strive to execute fewer paths for better effectiveness.

Outline of control flow testing Inputs o The source code of a program unit o A set of path selection criteria Examples of path selection criteria o Select paths such that every statement is executed at least once o Select paths such that every conditional statement evaluates to true and false at least once on different occasions

Control flow graph

Control Flow Graph (CFG) FILE *fptr1, *fptr2, *fptr3; /* These are global variables.*/ int openfiles(){ /* This function tries to open files "file1", "file2", and "file3" for read access, and returns the number of files successfully opened. The file pointers of the opened files are put in the global variables. */ int i = 0; if( ((( fptr1 = fopen("file1", "r")) != NULL) && (i++) && (0)) || ((( fptr2 = fopen("file2", "r")) != NULL) && (i++) && (0)) || ((( fptr3 = fopen("file3", "r")) != NULL) && (i++)) ); return(i); }

CFG

What paths do I select for testing? Select all paths. Select paths to achieve complete statement coverage. Select paths to achieve complete branch coverage. Select paths to achieve predicate coverage.

What paths do I select for testing? Select all paths. Select paths to achieve complete statement coverage. Select paths to achieve complete branch coverage. Select paths to achieve predicate coverage.

Path selection criteria FILE *fptr1, *fptr2, *fptr3; /* These are global variables.*/ int openfiles(){ /* This function tries to open files "file1", "file2", and "file3" for read access, and returns the number of files successfully opened. The file pointers of the opened files are put in the global variables. */ int i = 0; if( ((( fptr1 = fopen("file1", "r")) != NULL) && (i++) && (0)) || ((( fptr2 = fopen("file2", "r")) != NULL) && (i++) && (0)) || ((( fptr3 = fopen("file3", "r")) != NULL) && (i++)) ); return(i); }

Input Domain

Paths executed by the test inputs

What paths do I select for testing? Select all paths. Select paths to achieve complete statement coverage. Select paths to achieve complete branch coverage. Select paths to achieve predicate coverage.

Statement Coverage It refers to o Executing individual program statements and o Observing the outcome. 100% statement coverage has been achieved if o All the statements have been executed at least once Covering a statement in a program means o Visiting one or more nodes in a CFG

What paths do I select for testing? Select all paths. Select paths to achieve complete statement coverage. Select paths to achieve complete branch coverage. Select paths to achieve predicate coverage.

What paths do I select for testing? Select all paths. Select paths to achieve complete statement coverage. Select paths to achieve complete branch coverage. Select paths to achieve predicate coverage.

Example: Predicate coverage

Generating test input How to select input values, such that o When the program is executed with the selected inputs o The chosen paths get executed 1. Input Vector 2. Predicate 3. Path Predicate 4.Predicate Interpretation 5.Path Predicate Expression 6.Generating Input Data from Path Predicate Expression

Input Vector It is a collection of all data entities Members of an input vector of a routine can take different forms o Global variables and constants o Files o Contents of registers

Predicate A predicate is a logical function evaluated at a decision point The construct OB is the predicate in decision node 5

Path Predicate A path predicate is the set of predicates associated with a path. We must know whether the individual component predicates of a path predicate evaluate to true or false in order to generate path forcing inputs.

Predicate Interpretation The local variables are not visible outside a function We can easily substitute all the local variables in a predicate with the elements of the input vector The process of symbolically substituting operations along a path in order to express the predicates solely in terms of the input vector and a constant vector.

Path Predicate Expression An interpreted path predicate is called a path predicate expression o It is void of local variables o Path forcing input values can be generated by solving the set of constraints in a path predicate expression. o If the constraints can not be solved: infeasible path

Data Flow Testing A memory location corresponding to a program variable is accessed in a desirable way It is desirable to verify the correctness of a data value generated for a variable Programmer can perform a number of tests on data values Two types: Static, and Dynamic

Data flow anomaly A deviant or abnormal way of doing something The three abnormal situations Type 1: Defined and Then Defined Again Type 2: Undefined but Referenced Type 3: Defined but Not Referenced

State transition diagram of a variable

Dynamic data flow testing 1. Draw a data flow graph from a program. 2.Select one or more data flow testing criteria. 3.Identify paths in the data flow graph satisfying the selection criteria. 4.Derive path predicate expressions from the selected paths and solve those expressions to derive test input.

Thank you Next Lecture: Software Testing