Unit 6: Testing and Debuggin Flashcards
What is the goal of testing a program?
To find whether there are any ways in which the program fails to work correctly.
Why is “run it and see if it works” an inadequate testing method?
: Because different inputs can lead to different outcomes, and errors may not be obvious.
What is exhaustive testing and why is it impractical?
Testing every possible input; impractical due to the vast number of possibilities (e.g., testing two integers would take ~500,000 years).
What’s the difference between verification and validation?
Verification checks if the program meets the specification. Validation checks if the specification meets the user’s needs.
What is a specification in testing?
A precise description of what a program is supposed to do – essential for verification.
What are the main steps in the testing process?
- Analyse program/spec
- Select test data
- Predict results
- Run tests
- Compare actual and predicted results
What is black-box testing?
Testing based on the specification without looking at the code structure. Basically testing the program interface.
What is white-box testing?
Testing based on the internal structure of the code to ensure every path is tested.
What is a breakpoint in debugging?
A set point in the code where the debugger automatically pauses execution.
Why are diagnostic print statements sometimes not ideal?
They clutter the output and require editing the code, which can introduce new bugs.