Specifications and Testing


To treat the software under test as a black box by testing to the Application Programming Interface (API).

What role does testing play in the specification of software?

Part of the job of testing is to help refine the specification by figuring out what acceptable inputs and outputs are.

What are Domains and Ranges?

Domain: the set of possible inputs Range: the set of possible outputs

What are Software Domains and Ranges?

Software uses a super-set of the mathematical domains and ranges.

  • Domain: All inputs of the right type (or all inputs) 
  • Range: Union of valid range with a set of exceptions

Should You Use Defensive Coding?

  • Defensive Coding means to validate the input that users give you before proceeding.
  • Implementing checks for valid input makes the code slow and hard to read
  • Better to clearly specify the Domain in the documentation and raise an exception if an invalid output is produced.
From Udacity's Software Testing Unit 1.