LabManual
LabManual
1. OBJECTIVE:
To design test cases using the Boundary Value Analysis (BVA) technique and understand
its importance in software testing.
2. INTRODUCTION:
Boundary Value Analysis (BVA) is a black-box testing technique that focuses on testing
values at the boundaries of input domains rather than within the range. Since errors are
more likely to occur at the extreme ends of input values, BVA helps in identifying potential
defects effectively.
3. THEORY:
• BVA is based on the concept that errors often occur at input boundaries rather than
in the middle.
• Test cases are derived from the minimum, just above minimum, nominal, just
below maximum, and maximum values.
• It is widely used in validation of numeric inputs, array limits, and form fields.
Example of Boundary Value Selection: If an input field accepts values between 10 and
100, the test cases should consider:
5. PROCEDURE:
1. Identify the input domain (range of valid values).
2. Determine boundary values (minimum, just below minimum, just above minimum,
nominal, just below maximum, maximum, just above maximum).
3. Design test cases considering these boundary values.
4. Execute test cases and observe the system behaviour.
5. Compare expected results with actual results.
6. Document the findings.
Scenario:
A banking application allows users to transfer money between ₹1,000 and ₹50,000 per
transaction.
8. CONCLUSION:
Boundary Value Analysis is an effective technique to uncover defects at input boundaries.
It improves test coverage with minimal test cases, ensuring robustness in software
applications.
9. REFERENCES:
1. Software Testing by Ian Sommerville
2. Foundations of Software Testing by Aditya P. Mathur
3. IEEE Standards for Software Testing
TOPIC: DESIGN TEST CASES USING EQUIVALENCE CLASS PARTITIONING
1. OBJECTIVE:
To design test cases using the Equivalence Class Partitioning (ECP) technique and
understand its importance in software testing.
2. INTRODUCTION:
Equivalence Class Partitioning (ECP) is a black-box testing technique that divides input
data into different partitions or classes. Each partition represents a set of values that are
expected to be treated similarly by the system, reducing the total number of test cases
while maintaining high test coverage.
3. THEORY:
• ECP divides the input domain into equivalence classes of valid and invalid inputs.
• It ensures that at least one test case from each partition is executed.
• The technique is useful in scenarios where exhaustive testing is impractical.
4. EXPERIMENTAL SETUP:
• System with any programming language or test case management tool
• Software under test (SUT)
• Test case documentation template
5. PROCEDURE:
1. Identify the input domain and define equivalence classes (valid and invalid
partitions).
2. Select representative values from each partition.
3. Design test cases using these representative values.
4. Execute test cases and observe system behavior.
5. Compare expected results with actual results.
6. Document the findings.
Scenario:
A banking application allows users to transfer money between ₹1,000 and ₹50,000 per
transaction.
Equivalence
Test Case ID Input Amount (₹) Expected Output
Class
TC001 500 (Below Min) Invalid Error Message
TC002 1000 (Min) Valid Success
TC003 25000 (Mid-Range) Valid Success
TC004 50000 (Max) Valid Success
TC005 60000 (Above Max) Invalid Error Message
7. OBSERVATIONS:
• The system should correctly process valid transactions.
• The system should prevent transactions below ₹1,000 and above ₹50,000.
• Any deviation from expected results indicates a defect.
8. CONCLUSION:
Equivalence Class Partitioning is an effective technique that reduces test effort by
categorizing inputs into valid and invalid partitions, ensuring high coverage with minimal
test cases.
9. REFERENCES:
4. Software Testing by Ian Sommerville
5. Foundations of Software Testing by Aditya P. Mathur
6. IEEE Standards for Software Testing
TOPIC: DESIGN INDEPENDENT PATHS BY CALCULATING CYCLOMATIC
COMPLEXITY USING DATE PROBLEM
1. OBJECTIVE:
To design independent paths for a given program by calculating Cyclomatic Complexity
using the Date Problem and understand its importance in software testing.
2. INTRODUCTION:
Cyclomatic Complexity (CC) is a software metric used to measure the complexity of a
program. It is calculated using control flow graphs (CFG) and helps determine the number
of independent paths that should be tested to ensure maximum code coverage.
The Date Problem involves validating a given date based on day, month, and year
constraints (e.g., leap year conditions, valid month ranges, etc.).
3. THEORY:
• Cyclomatic Complexity (V(G)) is calculated using the formula:
Where:
5. PROCEDURE:
1. Analyze the Code: Examine the given Date Problem program.
2. Construct a Control Flow Graph (CFG):
a. Identify decision points and flow of execution.
3. Calculate Cyclomatic Complexity using the formula:
a. Count nodes (N), edges (E), and connected components (P).
4. Identify Independent Paths:
a. List all unique execution paths.
5. Design Test Cases:
a. Develop test cases covering all identified paths.
6. Execute and Document Findings:
a. Verify expected vs. actual results.
1. Start
2. Check year range
3. Check month range
4. Check day range
5. Check 30-day months
6. Check February conditions
7. Return result
• Nodes (N) = 7
• Edges (E) = 10
• Connected components (P) = 1
• V(G) = 10 - 7 + 2(1) = 5
Independent Paths:
7. OBSERVATIONS:
• The program has 5 independent paths, indicating 5 test cases for full coverage.
• Ensuring all paths are tested increases reliability.
• Any deviation from expected results indicates a defect.
8. CONCLUSION:
Cyclomatic Complexity helps determine the minimum number of test cases required for
full path coverage. By applying it to the Date Problem, we can effectively test all possible
scenarios and improve software reliability.
9. REFERENCES:
7. Software Testing by Ian Sommerville
8. Foundations of Software Testing by Aditya P. Mathur
9. IEEE Standards for Software Testing
TOPIC: DESIGN TEST CASES USING DECISION TABLE
1. OBJECTIVE:
To design and execute test cases using Decision Table Testing, ensuring systematic test
coverage for different input conditions and outcomes.
2. INTRODUCTION:
Decision Table Testing is a black-box test design technique used to handle complex
business logic with multiple conditions. It helps derive test cases by systematically
representing inputs and their corresponding expected outputs in a tabular form.
3. THEORY:
• Why use Decision Tables?
o Ensures comprehensive test coverage.
o Effective in identifying missing conditions or rules.
o Suitable for complex logic where multiple conditions interact.
• Structure of a Decision Table:
4. EXPERIMENTAL SETUP:
• Programming language or test case management tool.
• Software under test (SUT).
• Decision Table generation tool (optional).
5. PROCEDURE:
1. Identify the Conditions: List all possible input conditions.
2. Identify the Actions: Define expected system responses.
3. Construct the Decision Table:
a. Map out all combinations of conditions and corresponding actions.
4. Derive Test Cases:
a. Convert each rule into a test case.
5. Execute and Document Results:
a. Run test cases and verify expected vs. actual results.
Scenario: A user can log in only if both username and password are
correct.
Decision Table:
7. OBSERVATIONS:
• Decision Tables ensure all possible scenarios are tested.
• Helps identify redundant or missing test cases.
• Useful for business rule validation.
8. CONCLUSION:
Decision Table Testing is an efficient way to derive test cases when multiple conditions
influence the output. It enhances test coverage and prevents logical gaps in testing.
2. INTRODUCTION:
DD Path Testing is a structural testing technique where test paths are identified from
Decision-to-Decision (DD) nodesin the control flow graph. This method ensures that all
logical conditions in the code are exercised to improve code coverage and fault detection.
• Independent Path: A path that introduces at least one new edge not covered by
previous paths.
• Control Flow Graph (CFG): A graphical representation of program control flow with
nodes representing statements and edges showing transitions.
3. THEORY:
• Why use DD Path Testing?
o Ensures all control paths are tested.
o Helps detect untested conditions and branches.
o Reduces redundant test cases by focusing on decision points.
• Steps in DD Path Testing:
o Construct the Control Flow Graph (CFG) of the program.
o Identify Decision-to-Decision (DD) paths.
o Calculate Cyclomatic Complexity (V(G)):
5. PROCEDURE:
1. Define the Date Problem: Implement logic for validating a date (DD/MM/YYYY
format) considering leap years, month-day constraints, etc.
2. Construct the Control Flow Graph (CFG):
a. Identify decision points (if-else, loops, conditions).
b. Draw the CFG representing transitions between decision nodes.
3. Identify DD Paths:
a. Locate independent DD paths where decisions lead to new logic flows.
4. Calculate Cyclomatic Complexity:
a. Count number of edges (E) and nodes (N).
b. Apply formula: V(G) = E - N + 2.
5. Design and Execute Test Cases:
a. Create test cases covering all independent paths.
b. Execute and verify correctness.
(Start)
|
v
[Check Month] ---> (Invalid Month?) ----> [Print Invalid Month] --> (End)
|
v
[Check Day] ---> (Invalid Day?) ----> [Print Invalid Day] --> (End)
|
v
[Check Feb 29] ---> (Invalid?) ----> [Print Invalid Day] --> (End)
|
v
[Check 30-day months] ---> (Invalid?) ----> [Print Invalid Day] --> (End)
|
v
[Print Valid Date] --> (End)
• Nodes (N) = 6
• Edges (E) = 9
• V(G) = E - N + 2 = 9 - 6 + 2 = 5
Test
Date Input Expected Output
Case
TC1 15/07/2023 Valid Date
TC2 15/13/2023 Invalid Month
TC3 32/10/2023 Invalid Day
TC4 30/02/2023 Invalid Day for February
TC5 31/04/2023 Invalid Day for the month
7. OBSERVATIONS:
• DD Path Testing effectively ensures all decision points are covered.
• Cyclomatic Complexity helps in estimating the required test cases.
• Independent path identification prevents redundant tests and improves efficiency.
8. CONCLUSION:
DD Path Testing is a robust white-box testing technique that enhances code coverage by
identifying Decision-to-Decisionpaths. Applying it to a real-world problem like date
validation ensures efficient and thorough testing of all possible cases.