[INF43] Lecture 11 Testing part 1

软件工程 SoftwareEngineering


@ZYX 写于2020年05月19日


  1. Boeing 737
    1. Safety doesn’t come first, money comes first
    2. do not modify hardware problem but software because it is cheaper (but not safer)
    3. Do not provide ways for human interven, and assume software is always right
  2. Toyota "Unintended Acceleration"
    1. Spaghetti code
      1. no seperation of concern
      2. high cohesion and low coupling
    2. Untestable and unfixable
      1. fix one bug then create one bug
    3. No peer review
    4. Throw away errors but no addressing
    5. No standard safety check
  3. Apollo 8
    1. Making assumptions on what users will do and users won’t do
      1. assuming astronauts are always correct
    2. Heuristic evaluation
      1. Error prevention –> should assume users will make mistakes
  4. NASA Genesis Mission
    1. haven’t test the gravitiy censor because the previous works
  5. Mars Polar Mission
    1. One uninitialized variable
    2. Small bugs can cause large problem
  6. Y2K issue 千年虫
    1. Wrong assumptions on Dates and time
      1. Assume all days are 30 days
      2. Assume no leap years
      3. Assume no day light saving

Nasa cardinal rules

Quality Assurance

Verfication and Validation

  • Quality Assurance = All activities designed to measure and improve quality in a product
    1. Verification: Does it conform to specification
    2. Validation: Does it serve the purpose

QA techniques

  • Formal methods
  • Static analysis of program properties
  • Reviews and inspections
  • Testing

Testing (who, what, how)

Unit test

  1. Detect and correct errors in a software product
  2. Exercise a module, collection of modules, or system

Testing Terminology

Error (human mistake in programmer’s mind)

Fault or defect (discrepancy in code)

Failure (external behavior/execution/output is incorrect)

  • an error may not cause a fault, a fault may not casue a failure

Testing Goal

  • Find and fix failures/faults/errors
  • Improve confidence that the system performs as specified (verification) and as desired (validation)
  • All in a manner that is
    • Accurate
    • Complete Thorough
    • Repeatable
    • Systematic
      Program testing can be used to show the presence of bugs, but never to show their absence —[Dijkstra]

Level of Testing

System Tests (most expensive and slowest)
Integration Tests
Unit Tests (cheapest, quickest)

  • not black and white, there are gray areas between two levels