Faults, Errors, Failures CS 4501 / 6501 Software Testing

Slides:



Advertisements
Similar presentations
1 Software Testing and Quality Assurance Lecture 5 - Software Testing Techniques.
Advertisements

Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
Dr. Pedro Mejia Alvarez Software Testing Slide 1 Software Testing: Building Test Cases.
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering.
Software Quality Assurance & Testing Mistake in coding is called error, Error found by tester is called defect, Defect accepted by development team then.
Software Testing Content Essence Terminology Classification –Unit, System … –BlackBox, WhiteBox Debugging IEEE Standards.
Software Testing Mistake in coding is called error ,
Objectives Understand the basic concepts and definitions relating to testing, like error, fault, failure, test case, test suite, test harness. Explore.
CMSC 345 Fall 2000 Unit Testing. The testing process.
SWE 619 © Paul Ammann Procedural Abstraction and Design by Contract Paul Ammann Information & Software Engineering SWE 619 Software Construction cs.gmu.edu/~pammann/
Foundations of Software Testing Chapter 1: Preliminaries Last update: September 3, 2007 These slides are copyrighted. They are for use with the Foundations.
CSE403 Software Engineering Autumn 2001 More Testing Gary Kimura Lecture #10 October 22, 2001.
637 – Introduction (Ch 1) Introduction to Software Testing Chapter 1 Jeff Offutt Information & Software Engineering SWE 437 Software Testing
Today’s Agenda  HW #1  Finish Introduction  Input Space Partitioning Software Testing and Maintenance 1.
1 Introduction to Software Testing. Reading Assignment P. Ammann and J. Offutt “Introduction to Software Testing” ◦ Chapter 1 2.
1 Ch. 1: Software Development (Read) 5 Phases of Software Life Cycle: Problem Analysis and Specification Design Implementation (Coding) Testing, Execution.
© Paul Ammann, 2008 Design by Contract Paul Ammann CS/SWE 332.
Xusheng Xiao North Carolina State University CSC 720 Project Presentation 1.
Lecture Notes - Copyright © S. C. Kothari, All rights reserved.1 Efficient Debugging CPRE 556 Lecture 19.
Introduction to Software Testing Paul Ammann & Jeff Offutt Updated 24-August 2010.
Introduction to Software Testing. OUTLINE Introduction to Software Testing (Ch 1) 2 1.Spectacular Software Failures 2.Why Test? 3.What Do We Do When We.
Mutation Testing G. Rothermel. Fault-Based Testing White-box and black-box testing techniques use coverage of code or requirements as a “proxy” for designing.
Software Development Problem Analysis and Specification Design Implementation (Coding) Testing, Execution and Debugging Maintenance.
Introduction to Software Testing Chapter 9.2 Program-based Grammars Paul Ammann & Jeff Offutt
CPSC 871 John D. McGregor Module 8 Session 1 Testing.
TESTING FUNDAMENTALS BY K.KARTHIKEYAN.
CompSci 100E 18.1 Testing and Debugging Robert A Wagner.
Workshop on Integrating Software Testing into Programming Courses (WISTPC14:2) Friday July 18, 2014 Introduction to Software Testing.
Mutation Testing Breaking the application to test it.
Testing Overview Software Reliability Techniques Testing Concepts CEN 4010 Class 24 – 11/17.
Foundations of Software Testing Chapter 7: Test Adequacy Measurement and Enhancement Using Mutation Last update: September 3, 2007 These slides are copyrighted.
Introduction to Software Testing Model-Driven Test Design and Coverage testing Paul Ammann & Jeff Offutt Update.
CPSC 372 John D. McGregor Module 8 Session 1 Testing.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 17 – Specifications, error checking & assert.
Software Testing CS II: Data Structures & Abstraction
Testing Your Program: Input Space Partitioning
Insertion sort Loop invariants Dynamic memory
Testing Tutorial 7.
CS223: Software Engineering
Generating Automated Tests from Behavior Models
Software Testing Day 1: Preliminaries
John D. McGregor Session 9 Testing Vocabulary
Software Testing Introduction CS 4501 / 6501 Software Testing
Introduction to Software Testing Chapter 9.2 Program-based Grammars
Towers of Hanoi Move n (4) disks from pole A to pole C
Mutation Testing Moonzoo Kim School of Computing KAIST
Software Testing and Maintenance 1
Input Space Partition Testing CS 4501 / 6501 Software Testing
Paul Ammann & Jeff Offutt
Verification and Testing
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 6 Domain Testing
Types of Testing Visit to more Learning Resources.
John D. McGregor Session 9 Testing Vocabulary
Introduction to Software Testing Chapter 2 Model-Driven Test Design
John D. McGregor Session 9 Testing Vocabulary
Introduction to Software Testing Chapter 9.2 Program-based Grammars
Fault Injection: A Method for Validating Fault-tolerant System
Introduction to Software Testing Chapter 5.2 Program-based Grammars
CS 1111 Introduction to Programming Fall 2018
Coding Concepts (Basics)
ISP Coverage Criteria CS 4501 / 6501 Software Testing
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
CSE403 Software Engineering Autumn 2000 More Testing
Software Development Cycle
Regression Testing.
Mutation Testing Moonzoo Kim School of Computing KAIST
CPRE 416-Software Evolution and Maintenance-Lecture 11
Paul Ammann & Jeff Offutt
Software Testing and QA Theory and Practice (Chapter 5: Data Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
Mutation Testing Faults are introduced into the program by creating many versions of the program called mutants. Each mutant contains a single fault. Test.
Presentation transcript:

Faults, Errors, Failures CS 4501 / 6501 Software Testing

Test case consists of test values and expected results Software Testing Review Testing = process of finding input values to check against a software (focus of this course) Debugging = process of finding a fault given a failure Test case consists of test values and expected results Test values (inputs) Program Actual results Expected results vs Testing is fundamentally about choosing finite sets of values from the input domain of the software being tested Given the test inputs, compare the actual results with the expected results

Today’s Objective Understand the differences between faults, errors, and failures Understand how faults, errors, and failures affect the program Understand the four conditions that must be satisfied when designing tests Reachability, Infection, Propagation, Revealability (RIPR) model

Fault, Error, and Failure Fault: a static defect in the software’s source code Cause of a problem Error: An incorrect internal state that is the manifestation of some fault Erroneous program state caused by execution of the defect Failure: External, incorrect behavior with respect to the requirements or other descriptions of the expected behavior Propagation of erroneous state to the program outputs

Example #1 (Java) There is a simple fault in numZero public static int numZero (int[] arr) { // Effects: If arr is null throw NullPointerException // else return the number of occurrences of 0 in arr int count = 0; for (int i = 1; i < arr.length; i++) if (arr[i] == 0) count++; return count; } There is a simple fault in numZero Where is the fault location in the source code? How would you fix it? Can the fault location be reached? How does it corrupt program state? Does it always corrupt the program state? If the program state is corrupted, does numZero fail? How?

Example #1 – Let’s Analyze public static int numZero (int[] arr) { // Effects: If arr is null throw NullPointerException // else return the number of occurrences of 0 in arr int count = 0; for (int i = 1; i < arr.length; i++) if (arr[i] == 0) count++; return count; } Fault: a defect in source code Error: erroneous program state caused by execution of the defect Failure: propagation of erroneous state to the program outputs i = 1 [should start searching at 0, not 1] i becomes 1 [array entry 0 is not ever read] Happens as long as arr.length > 0 and arr[0] = 0

Example #1 – Test Cases public static int numZero (int[] arr) { // Effects: If arr is null throw NullPointerException // else return the number of occurrences of 0 in arr int count = 0; for (int i = 1; i < arr.length; i++) if (arr[i] == 0) count++; return count; } Fault: i = 1 [should start searching at 0, not 1] Test 1: [4, 6, 0], expected 1 Test 2: [0, 4, 6], expected 1 Error: i is 1, not 0, on the first iteration Failure: none Error: i is 1, not 0, error propagates to the variable count Failure: count is 0 at the return statement

Example #1 – State Representation public static int numZero (int[] arr) { // Effects: If arr is null throw NullPointerException // else return the number of occurrences of 0 in arr int count = 0; for (int i = 1; i < arr.length; i++) if (arr[i] == 0) count++; return count; } L1 L2 L3 L4 L5 Assume that we want to represent program states using the notation <var1=v1, …, varn = vn, PC=program counter> Sequence of states in the execution of numZero({0, 4, 6}) 1: < x={0, 4, 6}, PC=[int count=0 (L1)] > 2: < x={0, 4, 6}, count=0, PC=[i=1 (L2)] > 3: < x={0, 4, 6}, count=0, i=1, PC=[i<arr.length (L2)] > … < x={0, 4, 6}, count=0, PC=[return count; (L5)] >

Example #1 – Error State Error state The first different state in execution in comparison to an execution to the state sequence of what would be the correct program If the code had i=0 (correct program), the execution of numZero({0, 4, 6}) would be 1: < x={0, 4, 6}, PC=[int count=0 (L1)] > 2: < x={0, 4, 6}, count=0, PC=[i=0 (L2)] > 3: < x={0, 4, 6}, count=0, i=0, PC=[i<arr.length (L2)] > … Instead, we have 2: < x={0, 4, 6}, count=0, PC=[i=1 (L2)] > 3: < x={0, 4, 6}, count=0, i=1, PC=[i<arr.length (L2)] > The first error state is immediately after i=1 in line L2

RIPR Model Four conditions necessary for a failure to be observed Reachability The fault is reached Infection Execution of the fault leads to an incorrect program state (error) Propagation The infected state must cause the program output or final state to be incorrect (failure) Revealability The tester must observe part of the incorrect portion of the program state

RIPR Model Final program state and outputs Test Reaches Observed portion of the program state Fault location Incorrect portion of the final state Observed portion of the program state Observes Reveals Infects Observes Propagates Incorrect program states [AO, p.21]

Example #1 – RIPR (Error, No Failure) public static int numZero (int[] arr) { // Effects: If arr is null throw NullPointerException // else return the number of occurrences of 0 in arr int count = 0; for (int i = 1; i < arr.length; i++) if (arr[i] == 0) count++; return count; } L1 L2 L3 L4 L5 Revisit the example, apply RIPR to design tests that Reach a fault (i.e., execute the fault) Cause the program state to be incorrect (i.e., error) Does not propagate (i.e., no failure) One possible test is [4, 6, 0] – now, design some more How does RIPR model help designing tests?

Example #1 – RIPR (Error, Failure) public static int numZero (int[] arr) { // Effects: If arr is null throw NullPointerException // else return the number of occurrences of 0 in arr int count = 0; for (int i = 1; i < arr.length; i++) if (arr[i] == 0) count++; return count; } L1 L2 L3 L4 L5 Revisit the example, apply RIPR to design tests that Reach a fault (i.e., execute the fault) Cause the program state to be incorrect (i.e., error) Propagate (i.e., failure) One possible test is [0, 4, 6] – now, design some more How does RIPR model help designing tests?

Let’s do more exercises