SE Notes
Foundation concepts of software testing and quality verification.
Software testing is the systematic process of executing a program with the intent of finding defects. This definition, from Glenford Myers' seminal work "The Art of Software Testing," contains a crucial insight: the purpose of testing is not to prove software works correctly, but to demonstrate where it fails. A test that finds no bugs has not necessarily proven correctness—it may simply have failed to exercise the conditions under which bugs manifest. This mindset shift—from "proving it works" to "trying to break it"—is fundamental to effective testing.
Why Testing Matters
Software defects cost the global economy hundreds of billions of dollars annually. The Standish Group reports that the average software project spends 50% more than budgeted on defect correction. Defects that reach production cost 10-100 times more to fix than those caught during development. Beyond financial costs, software defects have caused rocket explosions (Ariane 5), radiation overdoses (Therac-25), financial losses (Knight Capital's $440 million in 45 minutes), and security breaches (Equifax's 147 million records exposed).
Testing is the primary mechanism for detecting defects before they reach users. While it cannot guarantee the absence of defects (proving a negative is logically impossible for non-trivial programs), systematic testing dramatically reduces the number and severity of defects that escape to production.
Fundamental Testing Principles
Principle 1: Testing shows the presence of defects, not their absence. No amount of testing can prove a system is defect-free. Testing can only demonstrate that specific defects exist.
Principle 2: Exhaustive testing is impossible. A simple function accepting two 32-bit integers has over 18 quintillion possible input combinations. Testing all of them is infeasible. Testing must be strategic—focusing effort where defects are most likely and most damaging.
Principle 3: Early testing saves time and money. A defect found during requirements analysis costs $100 to fix. The same defect found during testing costs $1,000. Found in production: $10,000+. Test activities should begin as early as possible.
Principle 4: Defect clustering. A small number of modules typically contain most of the defects. Research shows that 80% of defects cluster in 20% of modules. Focus testing effort on high-risk areas.
Principle 5: The pesticide paradox. Running the same tests repeatedly will not find new defects. Tests must be regularly reviewed and revised to detect new bug types—just as insects develop resistance to pesticides.
Principle 6: Testing is context-dependent. Safety-critical software (medical devices, aircraft) requires far more rigorous testing than a personal blog application. The approach must match the risk.
Principle 7: Absence-of-errors fallacy. Finding and fixing defects is worthless if the system does not meet user needs. A perfectly defect-free system that solves the wrong problem has no value.
Testing Levels
Testing is organized into progressive levels of scope:
Testing Types by Technique
Black-Box Testing: Design tests based on requirements without knowing internal code. Treat the system as a black box—input goes in, output comes out, verify the output is correct.
White-Box Testing: Design tests based on internal code structure. Ensure every statement, branch, and path is exercised.
Grey-Box Testing: Combination approach using some internal knowledge to design more effective black-box tests.
Static vs. Dynamic Testing
Static testing examines work products without executing code: code reviews, inspections, static analysis tools, and formal methods. Can find defects before code is even compilable.
Dynamic testing requires executing the software: running tests with inputs and checking outputs against expected results. Can only be performed on working (at least partially) software.
The Testing Process
Test Planning: Define strategy, scope, resources, schedule, and criteria for starting and stopping testing. Test Design: Create test cases from requirements and design specifications. Test Implementation: Set up test environment, prepare test data, automate test scripts. Test Execution: Run tests, record results, report defects. Evaluation: Assess test coverage, defect metrics, and determine if exit criteria are met.
Real-World Testing in Practice
Modern software teams combine manual and automated testing. Automated unit and integration tests run on every code commit (CI/CD pipeline). Manual exploratory testing supplements automation for usability and edge cases. Performance testing validates scalability before releases. Security testing (penetration testing, vulnerability scanning) protects against attacks. The specific mix depends on the application's risk profile, regulatory requirements, and team capabilities.
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Software Testing Introduction.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Software Engineering topic.
Search Terms
software-engineering, software engineering, software, engineering, testing, introduction, software testing introduction
Related Software Engineering Topics