Unit 3 of 4 · M.Sc IT Sem 2

Unit 3: Software testing

Software Engineering notes · PTU syllabus (PGCA1912)

3 min read10 topics10 exam questions
On this page
  1. Unit summary
  2. A strategic approach to software testing
  3. Verification and validation
  4. Unit and integration testing
  5. Validation and system testing
  6. Debugging
  7. Testing fundamentals
  8. Testability
  9. White-box testing and basis path testing
  10. Control structure testing
  11. Black-box testing
  12. Key terms
  13. Quick revision
  14. 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
Key formulasBasis path 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

1

Topic 1

A strategic approach to software testing

CycleTesting strategy spiral
Testing strategy spiral
1Unit testing
2Integration testing
3Validation testing
4System testing
  1. 1. Unit testing: Code
  2. 2. Integration testing: Design
  3. 3. Validation testing: Requirements
  4. 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.
2

Topic 2

Verification and validation

ComparisonVerification and validation
Verification
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

3

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).
4

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).
Key termsSystem tests
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
5

Topic 5

Debugging

ProcessDebugging process
  1. 1

    Execute test cases

  2. 2

    Observe results and symptoms

  3. 3

    Suspect causes

  4. 4

    Identify the cause

  5. 5

    Correct the error

  6. 6

    Run regression tests

Key termsDebugging strategies
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.
6

Topic 6

Testing fundamentals

Key termsTesting 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
7

Topic 7

Testability

Key termsCharacteristics of testable software
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
8

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.
ProcessBasis path testing
  1. 1Draw the flow graph from the code
  2. 2Compute cyclomatic complexity V(G)
  3. 3Find a basis set of independent paths
  4. 4Prepare a test case for each path
Key formulasCyclomatic complexity
  • 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).
9

Topic 9

Control structure testing

Key termsControl structure tests
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
10

Topic 10

Black-box testing

ComparisonBlack-box techniques
Idea
Example for marks 0–100

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

  1. Q1.Distinguish testing and debugging.
  2. Q2.What is an independent test group?
  3. Q3.Distinguish verification and validation.
  4. Q4.Name three debugging strategies.
  5. Q5.How are simple loops tested?
  6. Q6.What is boundary value analysis?

Long-answer questions

  1. Q1.Explain the strategic approach to software testing.
  2. Q2.Explain unit, integration, validation and system testing.
  3. Q3.Explain basis path and control structure testing.
  4. 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.

WhatsApp us