Testing Techniques and Levels of Testing



Testing Techniques

Testing techniques are systematic methods used to design test cases to identify defects in software. They help ensure that software works correctly, safely, and as expected.

Testing Techniques and Levels of Testing

Real-life analogy: Before an exam, students revise using different methods—reading notes, solving papers, and mock tests. Similarly, different testing techniques are used to test software.

White Box Testing (Structural Testing)

White box testing focuses on internal program logic, structure, and code flow. The tester must have knowledge of the source code.

Objectives:

  • Verify logical paths
  • Check loops and conditions
  • Ensure all statements are executed

Example: Testing whether all if–else conditions in a login validation program are executed.

White Box Approach to Test Design

In white box test design, test cases are created based on:

  • Program statements
  • Branches and conditions
  • Loops and paths

Common White Box Techniques

  • Statement coverage
  • Branch coverage
  • Path coverage

Example: Creating test cases so that every line of code in a salary calculation module is executed at least once.

Static Testing vs Structural Testing

FeatureStatic TestingStructural Testing
Code ExecutionNot executedExecuted
FocusDocuments & code reviewProgram logic
PurposeFind early defectsVerify execution paths
ExampleReviewing design documentRunning test cases

  • Static Testing Example: Reviewing requirement specifications to find missing requirements.
  • Structural Testing Example: Testing loop conditions in a billing program.

Code Functional Testing

Code functional testing verifies that each function or method performs its intended task according to the logic defined in the code.

Example: A function that calculates interest should correctly compute interest for different values of principal and rate.

Benefit: Ensures reliability of individual functions.

Coverage Testing

Coverage testing measures how much of the code is tested using test cases.

Types of Coverage

  • Statement Coverage – every line executed
  • Branch Coverage – every decision outcome tested
  • Path Coverage – every possible execution path tested

Example: Ensuring all conditions in an online payment validation code are executed.

Control Flow Graph (CFG)

A control flow graph is a graphical representation of program execution flow.

  • Nodes represent statements or blocks
  • Edges represent control flow

Purpose of CFG

  • Identify independent paths
  • Design effective test cases

Example: CFG of a login program showing valid and invalid password paths.

Black Box Testing

Black box testing focuses on software functionality without looking at internal code. Test cases are based on requirements and user expectations.

Example: Testing login feature using correct and incorrect credentials without knowing program logic.

Black Box Approach to Test Case Design

Test cases are designed using:

  • Input/output conditions
  • Functional requirements
  • User behavior

Common Black Box Techniques

  • Random testing
  • Requirements-based testing

Random Testing

Random testing involves providing random inputs to the system to find unexpected behavior.

Example: Entering random symbols and numbers in a registration form.

Advantages

  • Simple to perform
  • Can reveal hidden defects

Limitations:

  • Not systematic
  • May miss critical scenarios

Requirements-Based Testing

In this technique, test cases are designed directly from software requirements.

Steps

  • Study requirements
  • Identify expected behavior
  • Design test cases

Example: If requirement says “only PDF files allowed,” test cases verify PDF accepted and other formats rejected.

Comparison: White Box vs Black Box Testing

AspectWhite Box TestingBlack Box Testing
Code KnowledgeRequiredNot required
FocusInternal logicExternal behavior
Performed byDevelopers/TestersTesters
ExampleLoop testingFunctional testing

Summary

  • White box testing ensures internal correctness
  • Black box testing ensures functional correctness
  • Coverage and CFG improve test effectiveness
  • Requirements-based testing ensures user expectations are met

Decision Table Testing

Decision table testing is a black box testing technique used when software behavior depends on multiple conditions and rules.

Why it is needed: When there are many combinations of inputs, decision tables help ensure no condition is missed.

Structure of a Decision Table:

  • Conditions → Inputs
  • Actions → Outputs
  • Rules → Combination of conditions

Example (Loan Approval System)

IncomeCredit ScoreLoan Approved
HighGoodYes
HighPoorNo
LowGoodNo
LowPoorNo

Advantage

  • Easy to understand
  • Covers all logical combinations

Limitation

  • Becomes large if conditions increase

State-Based Testing

State-based testing checks system behavior based on states and transitions.

  • Key Concept: A system changes its state based on events or inputs.
  • Example (ATM Machine): Idle → Card Inserted → PIN Entered → Transaction → Exit
  • Why important: Ensures correct behavior during state transitions.

Cause-Effect Graphing

Cause-effect graphing identifies input conditions (causes) and output results (effects).

Process

  • Identify causes
  • Identify effects
  • Draw graph
  • Convert to decision table

Example: Cause: Wrong password Effect: Login denied

Benefit: Reduces redundant test cases

Error Guessing

Error guessing is an experience-based testing technique.

Concept: Tester predicts defects based on past experience and intuition.

Example

  • Submitting form without mandatory fields
  • Entering special characters in numeric fields

Advantage: Finds defects missed by formal techniques
Limitation: Depends on tester experience

Compatibility Testing

Compatibility testing checks whether software works correctly across:

  • Different browsers
  • Operating systems
  • Devices

Example: Testing a website on Chrome, Firefox, Edge, Android, and iOS.

Levels of Testing

Levels of testing ensure software quality at different development stages.

Unit Testing

Unit testing tests individual modules or functions.

Performed by: Developers Example: Testing addition function of calculator app.

Integration Testing

Integration testing verifies interaction between modules. Example: Login module interacting with database.

Types

  • Top-down
  • Bottom-up

Defect Bash Elimination

Defect bash is a group testing activity where testers aggressively try to break the system. Example: Before product release, testers stress the application using extreme inputs. 

Benefit: Finds hidden defects quickly

System Testing

System testing evaluates the complete integrated system.

Usability Testing

Usability testing checks user-friendliness and ease of useExample: Checking if users can easily navigate a mobile banking app.

Accessibility Testing

Accessibility testing ensures software is usable by people with disabilitiesExample: Screen reader support for visually impaired users.

Configuration Testing

Configuration testing verifies software under different hardware and software settings.

Example: Testing app performance on low RAM vs high RAM devices.

Compatibility Testing (System Level)

Ensures application works consistently across platforms.

Example: Banking app running smoothly on Android and iOS.

Summary Table

Testing TechniquePurpose
Decision TableLogical combinations
State-BasedState transitions
Error GuessingExperience-based
Unit TestingIndividual module
Integration TestingModule interaction
System TestingFull system