Unit 3: Software testing
Software Engineering notes · PTU syllabus (BSIT503/BSBC401)
On this page
- Unit summary
- Testing objectives
- Testing principles
- Testability
- White-box test case design
- Black-box test case design
- Verification and validation
- Testing strategy: unit, integration, validation and system testing
- Unit and integration testing in detail
- Validation and system testing in detail
- Key terms
- Quick revision
- Important questions
Unit summary
Testing is the last line of defence before users meet defects. This unit covers testing objectives, principles and testability, white-box and black-box test case design, verification and validation, and unit, integration, validation and system testing.
After this unit you can
- State testing objectives and principles
- Design white-box test cases using basis path testing
- Design black-box test cases
- Explain verification, validation and the testing strategy
PTU syllabus topics
- Testing objectives
- principles and testability
- white-box and black-box test case design
- verification and validation
- unit/integration/validation/system testing
Based on
Internal code structure
Requirements and behaviour
Techniques
Statement, branch, path coverage
Equivalence partitioning, boundary values
Done by
Developers
Testers and users
Finds
Logic errors
Missing or wrong functions
Topic 1
Testing objectives
- Testing is executing a program with the intent of finding errors; a good test case has a high probability of finding an undiscovered error; a successful test uncovers one (Glen Myers).
Topic 2
Testing principles
- 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 3
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 4
White-box test case design
- 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 5
Black-box test case design
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.
Topic 6
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 7
Testing strategy: unit, integration, validation and system testing
- 1Unit testing
Individual modules
- 2Integration testing
Modules combined: top-down or bottom-up
- 3Validation testing
Against requirements: alpha and beta
- 4System testing
Recovery, security, stress, performance
Based on
Specifications
Internal code
Techniques
Equivalence partitioning, boundary value analysis
Basis path testing, statement and branch coverage
Done by
Testers, users
Developers
Finds
Missing or wrong functions
Logic and path errors
Cyclomatic complexity V(G) = E − N + 2 (edges − nodes + 2) gives the number of independent paths to test. Debugging finds and fixes the cause of a failure, using brute force, backtracking or cause elimination.
Topic 8
Unit and integration testing in detail
- 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 9
Validation and system testing in detail
- 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
Key terms
- Testability
- Ease with which software can be tested
- Cyclomatic complexity
- Number of independent paths through code
- Equivalence partitioning
- Dividing input into classes tested by one value each
- Verification
- Checking that the product is built right
- Validation
- Checking that the right product is built
Quick revision
- Objectives and principles of testing; testability characteristics.
- White-box: basis path, V(G) three ways, loop testing.
- Black-box: equivalence partitioning, BVA, cause–effect, graph-based.
- Verification vs validation.
- Unit (drivers, stubs), integration (top-down, bottom-up, smoke), validation (alpha, beta), system tests.
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.State the objective of testing.
- Q2.What is testability?
- Q3.Compute V(G) for a graph with 9 edges and 7 nodes.
- Q4.Distinguish equivalence partitioning and boundary value analysis.
- Q5.Distinguish verification and validation.
- Q6.What is smoke testing?
Long-answer questions
- Q1.Explain testing principles and testability.
- Q2.Explain basis path testing with an example.
- Q3.Explain black-box test case design techniques.
- Q4.Explain the testing strategy from unit to system testing.
Stuck on this unit?
Message SBS on WhatsApp for help with Software Engineering, or to ask about studying B.Sc IT at Synetic.
