Unit 3: Software testing
Software Engineering notes · PTU syllabus (PGCA1912)
On this page
- Unit summary
- A strategic approach to software testing
- Verification and validation
- Unit and integration testing
- Validation and system testing
- Debugging
- Testing fundamentals
- Testability
- White-box testing and basis path testing
- Control structure testing
- Black-box testing
- Key terms
- Quick revision
- Important questions
Unit summary
Testing strategies and techniques uncover errors before the user does. This unit covers the strategic approach to testing, unit, integration, validation and system testing, debugging, testing fundamentals, white-box and basis path testing, control structure testing and black-box testing.
After this unit you can
- Explain the strategic approach and testing levels
- Explain the debugging process
- Design white-box tests with basis path and control structure testing
- Design black-box tests
PTU syllabus topics
- Approach to software testing
- unit/integration/validation/system testing
- debugging
- testing fundamentals
- white-box testing and basis path testing
- control structure testing
- black-box testing
Cyclomatic complexity
V(G) = E − N + 2
Alternative
V(G) = number of decision points + 1
Meaning
Number of independent paths to test
Guideline
V(G) above 10 suggests the module needs simplifying
Topic 1
A strategic approach to software testing
- 1. Unit testing: Code
- 2. Integration testing: Design
- 3. Validation testing: Requirements
- 4. System testing: System engineering
- Characteristics: testing begins at the component level and works outward; different techniques suit different points; it is done by developers and an independent test group (ITG); testing and debugging are different activities.
Topic 2
Verification and validation
Question
Are we building the product right?
Are we building the right product?
Checks
Conformance to specifications
Meets user needs
Methods
Reviews, walkthroughs, inspections, static analysis
Testing the executable product with users
Timing
Throughout development
Mainly at the end of each stage and delivery
Topic 3
Unit and integration testing
- Unit testing checks module interfaces, local data structures, boundary conditions, independent paths and error-handling paths, using drivers and stubs.
- Integration testing: top-down (depth-first or breadth-first, with stubs), bottom-up (clusters with drivers), regression testing after each addition, and smoke testing (daily builds).
Topic 4
Validation and system testing
- Validation testing: checks the software against the SRS — validation test criteria, configuration review, alpha testing (at the developer's site) and beta testing (at customer sites).
- Recovery testing
- Force failures and verify recovery
- Security testing
- Attempt to break protection
- Stress testing
- Abnormal quantity, frequency or volume of load
- Performance testing
- Run-time performance within the integrated system
- Deployment testing
- Different platforms and installation procedures
Topic 5
Debugging
- 1
Execute test cases
- 2
Observe results and symptoms
- 3
Suspect causes
- 4
Identify the cause
- 5
Correct the error
- 6
Run regression tests
- Brute force
- Memory dumps, print statements, traces — least efficient
- Backtracking
- Trace backward from the symptom to the cause
- Cause elimination
- Form hypotheses and eliminate them by tests (binary partitioning)
- Automated debugging
- Debuggers, static analysers, AI-assisted tools
- Why debugging is hard: symptom and cause may be far apart, symptoms may be intermittent, errors may come from timing or rounding, and fixing one error may hide or create another.
Topic 6
Testing fundamentals
- Traceable to requirements
- Tests check what customers need
- Planned early
- Test planning starts with requirements
- Pareto principle
- 80% of errors come from 20% of components
- Small to large
- Start with units, move to the system
- Exhaustive testing impossible
- Select test cases wisely
- Independent testers
- Third parties test more effectively
Topic 7
Testability
- Operability
- The better it works, the more efficiently it can be tested
- Observability
- What you see is what you test
- Controllability
- Inputs and states can be controlled
- Decomposability
- Modules can be tested independently
- Simplicity
- Less to test
- Stability
- Few changes during testing
- Understandability
- Good documentation
Topic 8
White-box testing and basis path testing
- White-box (glass-box) testing uses the control structure of the code to guarantee that all independent paths, decisions, loops and internal data structures are exercised.
- 1Draw the flow graph from the code
- 2Compute cyclomatic complexity V(G)
- 3Find a basis set of independent paths
- 4Prepare a test case for each path
Edges and nodes
V(G) = E − N + 2
Predicate nodes
V(G) = P + 1
Regions
V(G) = number of regions of the flow graph
Example
A flow graph with 11 edges and 9 nodes: V(G) = 11 − 9 + 2 = 4, so four independent paths need four test cases.
- Other techniques: condition testing, data flow testing, loop testing (simple, nested, concatenated, unstructured loops).
Topic 9
Control structure testing
- Condition testing
- Exercise each logical condition — relational and Boolean errors
- Data flow testing
- Select paths by definitions and uses of variables (DEF–USE chains)
- Loop testing: simple loops
- Skip, one pass, two passes, m passes, n − 1, n and n + 1 passes
- Loop testing: nested loops
- Start with the innermost loop, keep others at minimum
- Concatenated and unstructured loops
- Test as independent or nested; redesign unstructured loops
Topic 10
Black-box testing
Equivalence partitioning
Divide inputs into valid and invalid classes; test one value from each
Classes below 0, 0–100, above 100: test −5, 50, 120
Boundary value analysis
Errors cluster at edges; test at and around boundaries
−1, 0, 1, 99, 100, 101
Cause–effect graphing and decision tables
Map combinations of input conditions to actions
Fine rules for late returns
Graph-based testing
Model objects and relationships, test each link
Navigation between screens
- Black-box testing finds incorrect or missing functions, interface errors, data structure errors, performance and initialisation errors.
Key terms
- Independent test group
- Testers separate from developers
- Debugging
- Locating and fixing the cause of an error
- Basis path testing
- White-box method testing independent paths
- Condition testing
- Testing each logical condition in a program
- Equivalence partitioning
- Dividing inputs into classes tested by one value
Quick revision
- Strategy spiral; V&V; ITG.
- Unit (drivers, stubs), integration (top-down, bottom-up, regression, smoke), validation (alpha, beta), system (recovery, security, stress, performance).
- Debugging process; brute force, backtracking, cause elimination.
- Testability; basis path, V(G); condition, data flow and loop testing.
- Equivalence partitioning, BVA, graph-based, orthogonal array testing.
Important exam questions
Practice questions written to the PTU exam pattern for this unit's syllabus: short answers (Section A style) and long answers (Sections B and C style).
Short-answer questions
- Q1.Distinguish testing and debugging.
- Q2.What is an independent test group?
- Q3.Distinguish verification and validation.
- Q4.Name three debugging strategies.
- Q5.How are simple loops tested?
- Q6.What is boundary value analysis?
Long-answer questions
- Q1.Explain the strategic approach to software testing.
- Q2.Explain unit, integration, validation and system testing.
- Q3.Explain basis path and control structure testing.
- Q4.Explain black-box testing techniques.
Stuck on this unit?
Message SBS on WhatsApp for help with Software Engineering, or to ask about studying M.Sc IT at Synetic.
