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
ComparisonWhite-box vs black-box testing
White-box
Black-box

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

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

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.

8

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

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

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