Software Testing: Identifying Faults, Errors, and Failures, Summaries of Software Engineering

An example of a faulty program and asks the reader to identify the fault, potential test cases, and the first error state. It also explains the concept of reachability, infection, propagation, and revealability in the context of software testing. an extract from the book 'Introduction to Software Testing, Edition 2'.

Typology: Summaries

2021/2022

Uploaded on 06/05/2022

khalid-shawky
khalid-shawky 🇪🇬

12 documents

1 / 29

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Software Testing
Manar Elkady
Some of the material are retrieved from a previous course
offering by Dr.Soha Makady and Prof. Amr Kamel
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d

Partial preview of the text

Download Software Testing: Identifying Faults, Errors, and Failures and more Summaries Software Engineering in PDF only on Docsity!

Software Testing

Manar Elkady Some of the material are retrieved from a previous course offering by Dr.Soha Makady and Prof. Amr Kamel

Code Example 2: Fault, Error, Failure

public static void isLeap(int year) { if (year % 4 != 0) return false; if (year % 400 == 0) return true; if (year % 100 < 0) return false; return true; }

Leap Year

• Any year that is evenly divisible by 4 is a leap year.

  • for example, 1988, 1992, and 1996 are leap years.

public static bool isLeap(int year)

if (year % 4 != 0) return false;

return true;

Leap Year

• A year that is evenly divisible by 100 (for example, 1900) is

a leap year only if it is also evenly divisible by 400.

public static bool isLeap(int year)

if (year % 4 != 0) return false;

return true;

Code Example 2: Fault, Error, Failure

public static bool isLeap(int year) { if (year % 4 != 0) return false; if (year % 400 == 0) return true; if (year % 100 < 0) return false; return true; } Execution states:

  • Year = 2000, PC = isLeap()
  • Year = 2000, PC = if (year % 4 != 0)
  • Year = 2000, PC = if (year % 400 == 0)
  • Year = 2000, PC = return true; Did we reach the fault? Did we infect?

Code Example 2: Fault, Error, Failure

public static void isLeap(int year) { if (year % 4 != 0) return false; if (year % 400 == 0) return true; if (year % 100 < 0) return false; return true; } Execution states:

  • Year = 2001, PC = isLeap()
  • Year = 2001, PC = if (year % 4 != 0)
  • Year = 2001, PC = return false; Did we reach the fault? Did we infect?

Code Example 2: Fault, Error, Failure

public static void isLeap(int year) { if (year % 4 != 0) return false; if (year % 400 == 0) return true; if (year % 100 < 0) return false; return true; } Execution states:

  • Year = 2100, PC = isLeap()
  • Year = 2100, PC = if (year % 4 != 0)
  • Year = 2100, PC = if (year % 400 == 0)
  • Year = 2100, PC = if (year % 100 < 0)
  • Year = 2100, PC = return true; Did we reach the fault? Did we infect? The year 2100 is not a leap year in the Gregorian calendar (because while it is divisible by 4, it is also divisible by 100 but not 400)

Introduction to Software Testing, Edition 2 (Ch 2) © Ammann & Offutt 11

Testing & Debugging

  • Testing : Evaluating software by observing its execution
  • Test Failure : Execution of a test that results in a software

failure

  • Debugging : The process of finding a fault given a failure

Not all inputs will “trigger” a fault into

causing a failure

RIP-R Model

• Reachability

• Infection

• Propagation

• Revealability

Test Fault Incorrect Program State Test Oracles Final Program State Observed Final Program State Reaches Infects Propagates Reveals Incorrect Final State © Ammann & Offutt 13 Introduction to Software Testing, Edition 2 (Ch 2) Observed Final Program State

How do we deal with Faults, Errors, and Failures?

Software Testing – Basic Definitions (Cont’d)

  • Test case: A test case is a test-related item which contains the following information: - A set of test inputs - Execution conditions - Expected outputs
  • Test suite: A test suite is a group of related test cases.
  • Test oracle: A program, a document, or a formula that produces or specifies the expected outcome of a test, can serve as an oracle. - Are oracles easy to construct? E.g., GUI-testing,

usability testing.