Unit 3 of 4 · B.Sc IT Sem 5

Unit 3: Software testing

Software Engineering notes · PTU syllabus (BSIT503/BSBC401)

3 min read9 topics10 exam questions
On this page
  1. Unit summary
  2. Testing objectives
  3. Testing principles
  4. Testability
  5. White-box test case design
  6. Black-box test case design
  7. Verification and validation
  8. Testing strategy: unit, integration, validation and system testing
  9. Unit and integration testing in detail
  10. Validation and system testing in detail
  11. Key terms
  12. Quick revision
  13. 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
1

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

Example

A successful test: a test case enters a negative fee amount and the system accepts it — the test has found an error, so it is a successful test by Myers's definition.

Exam tip

Testing can show the presence of errors, never their absence.

2

Topic 2

Testing principles

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

Example

The Pareto principle in testing: after testing a college ERP, 80% of the defects are found in the fee and exam modules (20% of modules), so testers concentrate extra effort there.

Exam tip

Learn Davis's principles: traceable to requirements, planned early, Pareto, small to large, exhaustive testing impossible, independent testers.

3

Topic 3

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

Example

Improving testability: a module that writes its results to a log and has a clear interface is easy to test (observability, controllability). A module with hidden internal state and no outputs is hard to test.

Exam tip

The characteristics: operability, observability, controllability, decomposability, simplicity, stability and understandability.

4

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

Topic 5

Black-box test case design

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.

Example

Boundary value analysis: for marks valid from 0 to 100, test −1, 0, 1, 99, 100 and 101. Equivalence partitioning uses one value from each class — e.g. −5 (invalid), 50 (valid) and 150 (invalid).

Exam tip

Black-box tests are designed from requirements, without looking at the code.

6

Topic 6

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

Example

V and V in a project: reviewing the design document against the requirements is verification. Letting the college staff use the finished system to confirm it meets their needs is validation.

Exam tip

Verification: 'Are we building the product right?' Validation: 'Are we building the right product?'

7

Topic 7

Testing strategy: unit, integration, validation and system testing

ProcessTesting strategy (from small to large)
  1. 1Unit testing

    Individual modules

  2. 2Integration testing

    Modules combined: top-down or bottom-up

  3. 3Validation testing

    Against requirements: alpha and beta

  4. 4System testing

    Recovery, security, stress, performance

ComparisonBlack-box vs white-box testing
Black-box
White-box

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.

Example

Strategy in practice: each module (login, fees, exams) is unit-tested; modules are then combined and tested together (integration); the full system is checked against requirements (validation); finally, it is tested with the real hardware, network and load (system testing).

Exam tip

Move from small (unit) to large (system).

8

Topic 8

Unit and integration testing in detail

Integration can be top-down (start from the main module, using stubs for lower modules) or bottom-up (start from lowest modules, using drivers to call them). Regression testing re-runs earlier tests after changes.

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

Example

Stubs and drivers: testing the main menu before the report module is ready uses a stub that returns a fixed report. Testing the tax calculation before the main program exists uses a driver that calls it with test data.

Exam tip

Stub = dummy called module (top-down); driver = dummy calling module (bottom-up).

9

Topic 9

Validation and system testing in detail

Alpha testing is done by users at the developer's site; beta testing is done by users at their own sites. System testing includes recovery, security, stress and performance 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

Example

Stress testing: the college results portal is tested with 10,000 simultaneous users to check it does not crash on result day.

Exam tip

Name the types of system testing with one example each.

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

  1. Q1.State the objective of testing.
  2. Q2.What is testability?
  3. Q3.Compute V(G) for a graph with 9 edges and 7 nodes.
  4. Q4.Distinguish equivalence partitioning and boundary value analysis.
  5. Q5.Distinguish verification and validation.
  6. Q6.What is smoke testing?

Long-answer questions

  1. Q1.Explain testing principles and testability.
  2. Q2.Explain basis path testing with an example.
  3. Q3.Explain black-box test case design techniques.
  4. 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.

WhatsApp us