[INF43] Lecture 13 Testing part3

软件工程 SoftwareEngineering


@ZYX 写于2020年05月26日

Two overall testing approaches

  1. Black box testing
    1. Specification-based testing
      1. give input and use testing oracle to check whether output is success
  2. White box testing
    1. structural-based testing

Black box testing

  1. we dont know anytihing about internal
  2. we only knows inputs and outputs


  • Use specifications to derive test cases
  • Choose test cases that guarantee a wide range of coverage
    • Typical values
    • Boundary values
    • Special cases
    • Invalid input values

Equivalence Class Partitioning

This an approach to create test cases

  • Divide the input into several classes that are considered “equivalent” for the purposes of finding errors
    • If it fails/passes for one member of the class, it is likely to fail/pass for all members
  • Classes are determined by
    • Looking at the requirements specification
    • Tester’s intuition
  • Classes
    • should cover the complete input domain
    • should never overlap

Boundary value analysis

  • Experience has shown that many errors are made at the “boundaries” rather than under normal conditions
    • E.g., confusion between < and <=
  • Boundary value analysis tests at the boundaries of the classes, rather than just any element from the class

A Systematic approach

  1. Identify the set of all possible inputs (to what is being tested), aka “domain”
  2. Identify a basis for subdividing the set of inputs
    • Possible bases
      • Size/magnitude
      • Structure
      • Correctness
      • Your creative thinking
  3. Use this basis to divide the set of all possible inputs into classes/subdomains
  4. From each subdomain, select [a] representative(s) to be [a] test case input(s)
    • One test case may suffice
  5. Test for each subdomain
    • “Normal” values
    • Boundary or edge input values (Boundary Value Analysis)