Docsity

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

Partial preview of the text

Download Software Testing: Understanding 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

Software Testing – Basic Definitions

  • Software fault – often referred to as a bug: A static defect in software (incorrect lines of code)
  • Software error: An incorrect internal state (unobserved)
  • Software Failure: External, incorrect behavior with respect to the requirements or another description of the expected behavior When do failures happen? Any examples?

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 4 Erroneous State (“Error”)

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 5 Design Fault

Example: Fault, Error, Failure

  • Therac-25 was a radiation therapy machine

used to treat cancer.

  • Therac-25 had two modes of operation
    • Mode A delivered low doses of high energy.
    • Mode B delivered X-rays (high beams) into a target.
  • For mode B, a magnet had to be placed

between the beam and the target, in order to

correctly focus the X-rays.

Software Testing – Basic Definitions (An Example) Cont’d

  • What happened?
  • Instead of issuing a focused high beam, full powered radiations hit the patients.
  • How did that happen?
  1. Therac-25 had a one byte flag initialized to a non- zero value.
  2. As the employee is still positioning the light beam, the flag increments.
  3. As the employee finishes positioning the beam: a. the flag gets set to zero b. the magnet is placed c. the radiation is allowed to pass.

Code Example 1: Fault, Error, Failure

  • Fault?
  • For [2,7,0], what would the program state be?
  • Do we have an error state?
  • Do we have a failure? A state is in error simply if it is not the expected state, even if all of the values in the state, considered in isolation, are acceptable.

Code Example 1: Fault, Error, Failure

  • Fault?
  • For [0,7,2], what would be the program state?

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; }