Software Testing Methodologies and Techniques

Equivalence Class Testing (Equivalence Partitioning)

Equivalence Class Testing is a black box testing technique in which input data is divided into different groups called equivalence classes. Each class contains values that are expected to behave in the same way. Instead of testing every input value, only one value from each class is tested. This technique helps in reducing the number of test cases and saves time. Equivalence Class Testing is a software testing technique in which the input domain is divided into valid and invalid classes, and one representative value from each class is selected for testing.

Need for Equivalence Class Testing

  • Reduces the number of test cases
  • Saves testing time and cost
  • Improves test coverage
  • Helps in finding defects easily
  • Avoids repetitive testing

Types of Equivalence Classes

  1. Valid Equivalence Class: These are the inputs that the system should accept. Example: If the valid age is between 18 and 60, then values like 20, 35, and 50 are valid.
  2. Invalid Equivalence Class: These are the inputs that the system should reject. Example: Age less than 18 or greater than 60 is invalid.

Steps of Equivalence Class Testing

  • Identify the input conditions
  • Divide inputs into valid and invalid classes
  • Select one test case from each class
  • Execute the test cases
  • Check the output

Example of Equivalence Class Testing

Suppose a system accepts marks between 1 and 100.

  • Valid Class: 1 to 100
  • Invalid Class: Less than 1
  • Invalid Class: Greater than 100

Test Cases

  • 50: Accepted (Valid)
  • -5: Rejected (Invalid)
  • 120: Rejected (Invalid)

Here, one value from each class is tested instead of testing all numbers.

Advantages and Disadvantages

Advantages

  • Reduces testing efforts
  • Covers a large input range
  • Easy to design test cases
  • Efficient and time-saving
  • Useful for input validation

Disadvantages

  • May miss some boundary defects
  • Not suitable for complex logic alone
  • Requires proper identification of classes

Decision Table Testing

Decision Table Testing is a black box software testing technique in which different combinations of input conditions and their corresponding actions are represented in the form of a table called a decision table. It is mainly used when the system behavior depends on multiple conditions and different outputs are produced for different combinations of inputs. In this technique, testers identify all possible conditions, actions, and rules of the system and then prepare test cases accordingly. Each column of the table represents one rule or one possible combination of conditions. Decision Table Testing helps testers verify whether the software is giving correct results for all possible input combinations. It is commonly used in banking systems, login systems, billing systems, reservation systems, and business applications where many conditions are involved.

Need for Decision Table Testing

  • Handles complex business logic
  • Tests multiple conditions together
  • Improves test coverage
  • Reduces chances of missing test cases
  • Helps in finding logical errors

Components and Structure

  • Conditions: Input conditions given to the system.
  • Actions: Operations performed by the system.
  • Rules: Combinations of conditions and actions.

Structure: Conditions → Inputs; Actions → Outputs; Rules → Different combinations.

Example of Decision Table Testing

Suppose a login system works as follows: If Username and Password both are correct, login is successful; otherwise, login fails.

  • Rule 1: Username Correct (Yes) + Password Correct (Yes) → Action: Login Successful
  • Rule 2: Username Correct (Yes) + Password Correct (No) → Action: Login Failed
  • Rule 3: Username Correct (No) + Password Correct (Yes) → Action: Login Failed
  • Rule 4: Username Correct (No) + Password Correct (No) → Action: Login Failed

Advantages

  • Covers all possible conditions
  • Easy to understand
  • Detects missing cases
  • Useful for business applications
  • Improves testing quality

Disadvantages

  • Large tables become difficult to manage
  • Time-consuming for many conditions
  • Not suitable for simple applications

White Box Testing

White Box Testing is a software testing technique in which the internal structure, source code, logic, and working of the program are tested. In this testing, the tester has complete knowledge of the code and checks different statements, branches, conditions, loops, and paths of the program. The main purpose of White Box Testing is to verify that the internal operations of the software are working correctly. It helps in finding coding errors, logical mistakes, hidden bugs, and security problems.

Alternative Names

  • Glass Box Testing
  • Structural Testing
  • Open Box Testing
  • Clear Box Testing

Need for White Box Testing

  • To verify internal working of the program
  • To check correctness of program logic
  • To identify hidden coding errors
  • To test loops, conditions, and branches properly
  • To improve efficiency and quality of code
  • To ensure every statement is executed
  • To improve software security
  • To remove unnecessary or dead code
  • To detect errors at early stages of development
  • To improve overall software performance

Features of White Box Testing

  • Internal structure of the program is tested
  • Requires programming knowledge
  • Mostly performed by developers
  • Covers statements, branches, and paths
  • Helps in code optimization

Types of White Box Testing

  1. Statement Coverage: Checks whether all statements in the code are executed.
  2. Branch Coverage: Tests all possible branches of decision statements.
  3. Path Testing: Tests all independent paths of the program.
  4. Loop Testing: Checks the working of loops in the program.
  5. Condition Testing: Tests individual logical conditions in the code.

Example

Suppose a program checks whether a number is positive or negative: if(number > 0) print("Positive") else print("Negative").

  • Test Case 1: number = 5 → Output = Positive
  • Test Case 2: number = -2 → Output = Negative

In this example, both conditions and execution paths of the code are tested.

Advantages and Disadvantages

Advantages

  • Detects hidden errors in source code
  • Improves code quality and efficiency
  • Helps in optimization of software
  • Increases security of application
  • Ensures complete path coverage
  • Finds errors at an early stage
  • Removes unnecessary code

Disadvantages

  • Requires programming knowledge
  • Time-consuming for large applications
  • Difficult to perform on complex systems
  • Costly compared to black box testing
  • Not suitable for checking missing functionality

Detailed Classification of White Box Testing

1. Statement Coverage Testing

Every statement of the program is executed at least once. It helps in detecting unused statements and coding errors.

  • Advantages: Improves code coverage, detects unused code.
  • Disadvantages: Does not test all decision branches.

2. Branch Coverage Testing

Checks all possible branches of decision statements such as if-else and switch cases. Both true and false conditions are executed.

  • Advantages: Detects logical errors, tests decision making properly.
  • Disadvantages: Time-consuming for large programs, difficult for complex applications.

3. Path Testing

All independent execution paths from start to end are tested.

  • Advantages: Provides maximum test coverage, detects logical and path errors.
  • Disadvantages: Difficult for large software as the number of paths increases rapidly.

4. Loop Testing

Tests loops like for, while, and do-while for different numbers of iterations. Types include Simple, Nested, and Concatenated loops.

  • Advantages: Detects loop-related errors, verifies loop conditions.
  • Disadvantages: Complex for nested loops.

5. Condition Testing

Verifies individual logical conditions for true and false values.

  • Advantages: Detects logical condition errors, improves accuracy.
  • Disadvantages: Time-consuming for multiple conditions.

Unit Testing

Unit Testing is a technique in which individual units or small components are tested separately to verify they work according to requirements. A unit may be a function, method, procedure, class, or module. It is generally performed by developers during the coding phase and is considered the first level of software testing.

Objectives and Features

  • To verify correctness of individual units
  • To detect coding and logical errors early
  • To simplify the debugging process
  • To reduce testing and maintenance costs
  • Performed before Integration Testing

The Unit Testing Process

  1. Identify Units: Identify small modules to be tested.
  2. Design Test Cases: Prepare cases using valid and invalid input.
  3. Execute Test Cases: Run each unit with test data.
  4. Compare Results: Compare actual output with expected output.
  5. Fix Errors: Correct defects and test again.

Types of Unit Testing

  • Manual Unit Testing: Performed without automated tools. Simple for small programs but time-consuming.
  • Automated Unit Testing: Performed using tools and scripts. Faster and more accurate for large projects.

Example

Function: int add(int a, int b) { return a + b; }

  • add(2,3) → 5
  • add(5,7) → 12
  • add(-2,4) → 2
  • add(0,0) → 0

Advantages and Disadvantages

Advantages

  • Detects defects at an early stage
  • Simplifies debugging
  • Improves software quality
  • Makes maintenance easier

Disadvantages

  • Time-consuming for large systems
  • Requires programming knowledge
  • Cannot detect integration errors

System Testing

System Testing is a technique in which the complete and fully integrated software system is tested as a whole. It is performed after Integration Testing and before Acceptance Testing, focusing on external behavior and both functional and non-functional requirements.

Objectives and Features

  • To verify the complete software system
  • To check if the system meets user requirements
  • To identify defects in the integrated system
  • Mostly a black box testing technique
  • Performed in an environment similar to the real world

Types of System Testing

  1. Functional Testing: Checks if functions work correctly.
  2. Performance Testing: Checks speed, response time, and stability.
  3. Security Testing: Checks protection against unauthorized access and attacks.
  4. Usability Testing: Checks if the software is user-friendly.
  5. Compatibility Testing: Checks performance across different devices and browsers.
  6. Recovery Testing: Checks if the system can recover after a failure.

The System Testing Process

  1. Test Planning: Prepare objectives and strategies.
  2. Test Case Design: Create cases based on requirements.
  3. Test Environment Setup: Prepare hardware and software.
  4. Test Execution: Execute cases on the complete system.
  5. Defect Reporting: Identify and report errors.
  6. Retesting: Fix and verify defects.

Example of System Testing

In an Online Shopping System, modules like Login, Product Search, Payment, and Order are tested together. A tester checks the flow from logging in and searching for a product to making a payment and successfully placing an order.

Advantages

  • Tests the complete software system
  • Detects defects in an integrated environment
  • Verifies system requirements properly
  • Improves software quality, reliability, and performance