0% found this document useful (0 votes)
4 views20 pages

Software Testing Study Guide

This study guide covers software testing fundamentals, including definitions, testing life cycles, and various testing strategies. It provides detailed explanations of concepts such as boundary value testing, equivalence testing, and decision tables, along with examples and test case development. The guide is structured into sections for different question types and includes practical problem solutions.

Uploaded by

vicious.skull02
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views20 pages

Software Testing Study Guide

This study guide covers software testing fundamentals, including definitions, testing life cycles, and various testing strategies. It provides detailed explanations of concepts such as boundary value testing, equivalence testing, and decision tables, along with examples and test case development. The guide is structured into sections for different question types and includes practical problem solutions.

Uploaded by

vicious.skull02
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

SOFTWARE TESTING - INTERNALS

STUDY GUIDE
6th Semester | Complete Answer Guide

TABLE OF CONTENTS
1. 2-Mark Questions & Answers
2. 4-Mark Questions & Answers
3. 6-Mark Questions & Answers
4. Important Concepts & Definitions
5. Problem Solutions (ATM, Commission, Triangle, NextDate)
6. Decision Tables Explained
7. Test Case Development Guide
2-MARK QUESTIONS & ANSWERS
Define Software Testing?
Software testing is a process of evaluating software to find defects and ensure it meets
specified requirements. It involves executing a program to identify failures and verify that
the software works as intended.

What is Software Testing Life Cycle (STLC)?


STLC is a systematic process that includes planning, design, execution, and closure of
software testing. The main phases are: Requirements Analysis → Test Planning → Test
Design → Test Execution → Test Closure.

Define Error and Fault with examples


ERROR: A mistake made by a programmer (human action). Example: Typing wrong variable
name.
FAULT: The actual defect in the code resulting from an error. Example: A function returning
incorrect value due to wrong variable.
FAILURE: When the software does not behave as expected.

Write the Fundamental of Software Testing


Key fundamentals include:
• Testing is process of executing software with intent to find bugs
• Exhaustive testing is impossible
• Testing should start early in development
• Testing should focus on different areas
• 80/20 rule applies (most bugs in 20% of code)
• Testing should be objective and unbiased

What are Levels of Testing?


1. Unit Testing: Testing individual modules
2. Integration Testing: Testing combined modules
3. System Testing: Testing complete system
4. UAT: Testing by end users
5. Acceptance Testing: Client validation
What is Boundary Value Testing (BVT)?
Testing at boundary/edge values of input ranges. If range is 1-100, test values: 0, 1, 50, 99,
100, 101. Most errors occur at boundaries, making this effective.

Difference between Validation and Verification


VALIDATION: Are we building the RIGHT product? Focuses on user requirements.
VERIFICATION: Are we building the product RIGHT? Focuses on design specifications.
Validation = Testing finished product meets requirements.
Verification = Testing development process follows specifications.

What is Slice-Based Testing?


Testing based on program slices - subsets of program statements that affect specific
variable. Useful for finding bugs related to specific variables in complex programs.

What is Equivalence Testing?


Dividing input domain into classes where software should behave identically. Testing one
value from each class. Reduces test cases while maintaining coverage.

Valid and Invalid Equivalence Classes


VALID CLASS: Range of inputs that should be accepted and processed correctly.
INVALID CLASS: Inputs that should be rejected or cause errors.
Example for age input 18-65:
VALID: 18-65
INVALID: <18, >65

Define Weak Normal Equivalence Class Testing (WNECT)


Testing where you have one test case per equivalence class, testing only one variable at a
time. Used when input domains are independent. Less thorough than Robust testing.

Conditions and Actions in Decision Table


CONDITIONS: Input values or decisions that determine program behavior.
ACTIONS: Output or process executed based on condition combinations.
Example: IF (age>18 AND income>5lakh) THEN approve_loan
Two Advantages of Decision Table Testing
1. Systematic coverage of all condition combinations
2. Identifies missing test cases and specification gaps
3. Reduces redundant test cases
4. Documents complex business logic clearly
4-MARK QUESTIONS & ANSWERS

Explain Software Testing Life Cycle (STLC)


STLC consists of 6 phases:

1. PLANNING: Identify scope, objectives, schedule, resources, and test strategy


2. ANALYSIS: Review requirements and create test strategy document
3. DESIGN: Create test cases, test data, and automation scripts
4. EXECUTION: Run test cases, document results, report bugs
5. CLOSURE: Verify all requirements are tested, document lessons learned
6. MAINTENANCE: Perform regression testing for fixes

Key activities include requirement analysis, test plan creation, test case documentation,
defect tracking, and final reporting.

What do you mean by Incident? Explain with example


INCIDENT: Any event that occurs during testing that requires investigation.

Types of Incidents:
1. FAILURE: Unintended result (test fails)
2. ANOMALY: Unexpected behavior found
3. ISSUE: Missing functionality

Example:
- LOGIN SCREEN: Testing with username="admin", password="123"
- Expected Result: Login successful, redirect to dashboard
- Actual Result: Shows "Invalid credentials" error
- This is an INCIDENT (failure) that must be reported and investigated

Write One Test Case (Login Case)


Test Case ID: TC_LOGIN_001

Field Value
Test Case Title Valid Login with Correct Credentials
Objective Verify user can login with valid credentials
Pre-conditions Application is running, user account exists
Test Steps 1. Enter valid username
2. Enter valid password
3. Click Login button
Expected Result User logs in successfully and dashboard is
displayed
Actual Result (To be filled during execution)
Status Pass/Fail
Date (Date of execution)

Explain Class Test Case for Triangle Problem


TRIANGLE PROBLEM: Given 3 sides (a, b, c), determine triangle type.

CLASSIFICATION:
- Invalid: Any side ≤ 0, or violates triangle inequality (a+b≤c, etc.)
- Equilateral: a=b=c (all sides equal)
- Isosceles: Exactly 2 sides equal (a=b OR b=c OR a=c)
- Scalene: All sides different

TEST CASES:
1. Invalid: (0, 5, 5) → Error
2. Invalid: (1, 2, 10) → Error (fails triangle inequality)
3. Equilateral: (5, 5, 5) → Equilateral
4. Isosceles: (5, 5, 7) → Isosceles
5. Scalene: (3, 4, 5) → Scalene
6. Boundary: (1, 1, 1) → Equilateral
7. Edge: (1, 2, 2) → Isosceles (boundary of isosceles)
Explain Random Testing
DEFINITION: Testing with randomly selected inputs without predetermined test cases.

ADVANTAGES:
• Unbiased - no tester bias
• Can find unexpected bugs
• Quick test generation
• Good for stress testing
• Applicable to any software

DISADVANTAGES:
• No systematic coverage
• Cannot reproduce bugs easily
• Difficult to justify test results
• May miss critical paths
• Less effective for specific requirements
• Requires long execution time for good coverage

Black-Box vs White-Box Testing


BLACK-BOX TESTING (BBT):
• Tests external behavior/functionality
• No knowledge of internal code
• Based on specifications only
• Input-output testing
• Examples: Functional testing, User Acceptance Testing
• Advantage: User perspective, finds specification gaps
• Disadvantage: Cannot ensure code coverage

WHITE-BOX TESTING (WBT):


• Tests internal code structure
• Full knowledge of source code
• Based on code structure
• Tests all paths, branches, conditions
• Examples: Unit testing, Integration testing
• Advantage: High code coverage, finds logic errors
• Disadvantage: Requires coding knowledge, time-consuming

Guidelines for Boundary Value Testing


1. IDENTIFY BOUNDARIES: Find all input ranges and their limits
2. SELECT VALUES: For range [a, b], test: a-1, a, a+1, b-1, b, b+1
3. EXTREME VALUES: Test minimum and maximum valid values
4. MULTIPLE VARIABLES: Apply BVT to each variable independently
5. CLOSED VS OPEN: [1-100] vs (1-100) affects boundary values
6. SPECIAL VALUES: Test 0, negative, null, empty for special cases
7. OFF-BY-ONE ERRORS: Common at boundaries; test carefully
8. DOCUMENT RESULTS: Record boundary violations found

EXAMPLE - Age Input (18-65):


• Below: 17
• Lower boundary: 18
• Within: 40
• Upper boundary: 65
• Above: 66
6-MARK QUESTIONS & ANSWERS

Explain Testing Strategy for Simple ATM System (SATM)


ATM TESTING STRATEGY includes:

FUNCTIONAL TESTING:
• Valid card verification
• PIN validation (correct/incorrect)
• Balance inquiry
• Withdrawal (sufficient/insufficient balance)
• Deposit functionality
• Transfer between accounts

BOUNDARY TESTING:
• Maximum withdrawal amount
• Maximum deposit amount
• Card expiry dates
• Transaction limits

NEGATIVE TESTING:
• Invalid PIN attempts (lock after 3 attempts)
• Expired card rejection
• Invalid amount entry
• Network disconnection scenarios

SECURITY TESTING:
• Session timeout
• Password encryption
• Card data protection
• Unauthorized access prevention

USER INTERFACE TESTING:


• Screen display
• Button responsiveness
• Error messages
• Navigation flow

TEST CASES:
1. TC_ATM_001: Valid withdrawal with sufficient balance
2. TC_ATM_002: Withdrawal with insufficient balance
3. TC_ATM_003: Invalid PIN (3 attempts)
4. TC_ATM_004: Expired card
5. TC_ATM_005: Balance inquiry
6. TC_ATM_006: Session timeout

Explain Commission Problem with All Conditions


COMMISSION PROBLEM: Calculate commission based on item sales

INPUT:
• Lock sales (price: 45)
• Stock sales (price: 30)
• Barrel sales (price: 25)

CONDITIONS:
1. Sales > 1800: Commission = 10%
2. Sales 1000-1800: Commission = 15%
3. Sales < 1000: Commission = 0% (invalid)
4. Total locks = 1-70
5. Total stocks = 1-80
6. Total barrels = 1-90

OUTPUT:
• Valid: Commission amount
• Invalid: Error message

DECISION TABLE:
| Locks | Stocks | Barrels | Total Sales | Commission | Valid? |
|-------|--------|---------|-------------|------------|--------|
| 0-70 | 0-80 | 0-90 | >1800 | 10% | Yes |
| 0-70 | 0-80 | 0-90 | 1000-1800 | 15% | Yes |
| 0-70 | 0-80 | 0-90 | <1000 | Invalid | No |

Explain Weak Normal Equivalence Class Testing (WNECT)


WEAK NORMAL EQUIVALENCE CLASS TESTING:

DEFINITION: Test with ONE representative from each equivalence class, testing variables
INDEPENDENTLY.

CHARACTERISTICS:
• Tests one variable at a time
• One test case per equivalence class
• Less thorough than Robust testing
• Suitable when input domains are INDEPENDENT
• Produces fewer test cases

EXAMPLE - Triangle Problem:


Valid Classes:
• Equilateral (all equal)
• Isosceles (two equal)
• Scalene (all different)
Invalid Classes:
• Non-triangle (triangle inequality fails)
• Invalid input (≤0)

WNECT TEST CASES (one from each class):


1. (5, 5, 5) - Equilateral [Valid]
2. (5, 5, 7) - Isosceles [Valid]
3. (3, 4, 5) - Scalene [Valid]
4. (1, 2, 10) - Non-triangle [Invalid]
5. (0, 5, 5) - Invalid input [Invalid]

Total: 5 test cases (vs Robust would need more combinations)

Explain Structural vs Behavioral Testing


STRUCTURAL TESTING (White-Box):
Focus: INTERNAL STRUCTURE and CODE
Tests:
• All statements (statement coverage)
• All branches (branch coverage)
• All paths (path coverage)
• All conditions (condition coverage)

Example - Code Structure:


if (age > 18 AND income > 100000)
approve_loan()
else
reject_loan()

Structural test cases:


1. (age=25, income=150000) → true → approve
2. (age=15, income=150000) → false → reject

BEHAVIORAL TESTING (Black-Box):


Focus: EXTERNAL BEHAVIOR and SPECIFICATIONS
Tests:
• Functional requirements
• Business rules
• User workflows
• Integration with other systems
Example - Specification:
"Loan approved if age>18 AND income>100000"

Behavioral test cases:


1. Valid: (25, 150000) → approve
2. Young: (15, 150000) → reject
3. Low income: (25, 50000) → reject
4. Both invalid: (15, 50000) → reject

KEY DIFFERENCES:
• Structural: Code-focused vs Behavioral: Requirement-focused
• Structural: Developers create vs Behavioral: QA/Testers create
• Structural: Detailed coverage vs Behavioral: Functional coverage
Compare BVA, Robustness, and Worst-Case Testing
BOUNDARY VALUE ANALYSIS (BVA):
• Tests valid boundaries only
• For range [a, b]: tests a-1, a, a+1, b-1, b, b+1
• Tests valid behavior at limits
• 6N+1 test cases (N = number of variables)

Example - Age [18-65]:


Test: 17, 18, 19, 64, 65, 66

ROBUSTNESS TESTING:
• EXTENDS BVA with invalid boundary values
• Tests invalid inputs at boundaries
• For range [a, b]: tests a-1, a, a+1, b-1, b, b+1 + invalid extremes
• 6N+1 + invalid cases
• Verifies error handling

Example - Age [18-65]:


Valid boundary + Invalid extremes: 17, 18, 19, 64, 65, 66
Invalid tests: negative age, >150 age

WORST-CASE TESTING:
• Tests MULTIPLE VARIABLES together at boundaries
• Cartesian product of all boundaries
• For N variables: 5^N test cases
• Most comprehensive but most expensive

Example - Age [18-65], Income [20000-100000]:


1. (17, 19999) - both below
2. (18, 20000) - both at lower
3. (19, 20001) - both above lower
4. (65, 100000) - both at upper
5. (66, 100001) - both above
... (25 combinations total)

COMPARISON TABLE:
| Aspect | BVA | Robustness | Worst-Case |
|--------|-----|-----------|------------|
| Variables | Single | Single | Multiple |
| Invalid tested | No | Yes | Yes |
| Test cases | 6N+1 | More | 5^N |
| Cost | Low | Medium | High |
| Effectiveness | Good | Better | Best |
DECISION TABLES EXPLAINED

Structure of Decision Table


COMPONENTS:

1. CONDITIONS (rows): Input values/decisions


• Listed in first column
• Each condition has TRUE/FALSE

2. ACTIONS (rows): Outputs/processes


• Listed after conditions
• Executed based on condition combinations

3. RULES (columns): Test cases


• Each column is one rule/test case
• Shows condition+action combinations
• Y = condition true, N = condition false

EXAMPLE - Loan Approval:


Conditions:
- Age > 18
- Income > 100000
- Credit score > 700

Actions:
- Approve loan
- Reject loan
- Review by manager

Structure:
Rule1 Rule2 Rule3 Rule4
Age Y Y N Y
Inc Y N Y Y
Cred Y Y Y N
---
Appr Y N N N
Rej N Y Y Y
Mgr N N N Y

Decision Table for Triangle Problem


TRIANGLE CLASSIFICATION:
Conditions:
1. a = b (sides a and b equal)
2. b = c (sides b and c equal)
3. a + b > c (triangle inequality)

Valid outcomes:
- Equilateral (all equal)
- Isosceles (two equal)
- Scalene (all different)
- Invalid/Not a triangle

DECISION TABLE:
R1 R2 R3 R4 R5 R6
a=b T T T F F F
b=c T T F T F F
a+b>c T T T T T T
-------- --- --- --- --- --- ---
EQU Y N N N N N
ISO N Y Y Y N N
SCA N N N N Y N
INV N N N N N Y

TEST CASES FROM TABLE:


Rule 1: a=5, b=5, c=5 → Equilateral
Rule 2: a=5, b=5, c=7 → Isosceles
Rule 3: a=5, b=7, c=5 → Isosceles
Rule 4: a=7, b=5, c=5 → Isosceles
Rule 5: a=3, b=4, c=5 → Scalene
Rule 6: a=1, b=2, c=10 → Invalid

Decision Table for NextDate Function


NEXTDATE: Find next date given current date

Conditions:
1. Day < 28
2. Month has 30 days
3. Month has 31 days
4. Leap year

Actions:
- Increment day
- Increment month
- Increment year
- Invalid date
SIMPLIFIED DECISION TABLE:
R1 R2 R3 R4
Day<28 T T F F
Day=28 N N T T
Feb N T N N
Leap N N T F
------- --- --- --- ---
IncDay Y N N N
IncMon N Y Y N
IncYr N N N Y

SAMPLE TEST CASES:


Rule 1: Jan 10 → Jan 11 (increment day)
Rule 2: Feb 28, Leap year → Feb 29 (increment day)
Rule 3: Feb 28, Non-leap → Mar 1 (increment month)
Rule 4: Dec 31 → Jan 1, next year (increment year)
Decision Table for Commission Problem
COMMISSION CALCULATION:

Inputs:
- Number of locks (45 each)
- Number of stocks (30 each)
- Number of barrels (25 each)

Conditions:
1. Sales 1800-2400 → 10% commission
2. Sales 1000-1799 → 15% commission
3. Sales < 1000 → Invalid/0%
4. Locks: 1-70
5. Stocks: 1-80
6. Barrels: 1-90

DECISION TABLE (Simplified):


R1 R2 R3
Sales>1800 Y N N
Sales>1000 Y Y N
Valid Y Y N
------- ----- ----- -----
10% Y N N
15% N Y N
0%/Invalid N N Y

DERIVED TEST CASES:


Rule 1: L=40, S=40, B=40 → Total=3050 → 305 commission (10%)
Rule 2: L=20, S=20, B=20 → Total=1550 → 232.5 commission (15%)
Rule 3: L=5, S=5, B=5 → Total=400 → Invalid (0%)
TEST CASE DEVELOPMENT GUIDE

Best Practices for Writing Test Cases


1. TEST CASE FORMAT:
- Unique ID (TC_MODULE_001)
- Title (clear and descriptive)
- Objective (what to verify)
- Pre-conditions (setup required)
- Test Steps (numbered, detailed)
- Expected Result (what should happen)
- Actual Result (after execution)
- Status (Pass/Fail)

2. TEST STEPS:
- Use clear, simple language
- One action per step
- Number all steps
- Include inputs and expected outputs
- Avoid ambiguity

3. EXPECTED RESULTS:
- Be specific
- Include exact values if applicable
- State all conditions that should be satisfied
- Include error messages if applicable

4. COVERAGE:
- Test positive (valid inputs)
- Test negative (invalid inputs)
- Test boundaries (edge cases)
- Test combinations (multiple conditions)
- Test error conditions

5. TRACEABILITY:
- Link to requirements
- Document which requirement each test covers
- Maintain traceability matrix

6. MAINTENANCE:
- Keep test cases updated
- Remove obsolete tests
- Review regularly
- Version control

Key Formulas & Metrics


EQUIVALENCE CLASSES:
• Number of test cases ≈ Number of equivalence classes

BOUNDARY VALUE ANALYSIS:


• Test cases for N variables = 6N + 1
• Example: 2 variables = 6(2) + 1 = 13 test cases

ROBUSTNESS TESTING:
• Test cases = 6N + 1 + invalid boundary cases

WORST-CASE TESTING:
• Test cases for N variables = 5^N
• Example: 3 variables = 5^3 = 125 test cases

DECISION TABLE:
• Columns = Rules (test cases)
• Rows = Conditions + Actions

CODE COVERAGE:
• Statement Coverage: (Executed statements / Total statements) × 100
• Branch Coverage: (Executed branches / Total branches) × 100
• Path Coverage: (Executed paths / Total paths) × 100

You might also like