Master manual testing techniques and test case design methodologies.
Master manual testing techniques and test case design methodologies.
Learn how to write effective test cases that cover all scenarios and requirements
Content by: Paras Dadhania
Software Testing & QA Specialist
Test Case ID: TC_LOGIN_001
Test Description: Verify user can login with valid credentials
Preconditions: 
- User account exists in system
- User is on login page
- Database is accessible
Test Steps:
1. Enter valid username "testuser"
2. Enter valid password "testpass123"
3. Click "Login" button
4. Wait for page to load
Expected Result: 
- User should be redirected to dashboard
- Welcome message should display
- User menu should be visible
Actual Result: [To be filled during execution]
Status: [Pass/Fail/Blocked]Test your understanding of this topic:
Learn black box testing techniques that focus on functionality without knowing internal code
Content by: Yash Sanghavi
Software Testing & QA Specialist
// Equivalence Partitioning
// Divide input data into valid and invalid groups
function testAgeValidation() {
    // Valid partitions: 18-65
    // Invalid partitions: <18, >65, non-numeric
    
    // Valid test cases
    testValidAge(25); // Should pass
    testValidAge(18); // Should pass
    testValidAge(65); // Should pass
    
    // Invalid test cases
    testInvalidAge(17); // Should fail
    testInvalidAge(66); // Should fail
    testInvalidAge("abc"); // Should fail
}
// Boundary Value Analysis
// Test values at boundaries of input ranges
function testBoundaryValues() {
    // For age range 18-65
    // Test boundaries: 17, 18, 19, 64, 65, 66
    
    testBoundary(17); // Just below minimum
    testBoundary(18); // Minimum valid
    testBoundary(19); // Just above minimum
    testBoundary(64); // Just below maximum
    testBoundary(65); // Maximum valid
    testBoundary(66); // Just above maximum
}
// Decision Table Testing
// Test different combinations of conditions
function testLoginDecisionTable() {
    // Conditions: Valid username, Valid password, Account active
    // Rules: All combinations of true/false
    
    // Rule 1: All true -> Login successful
    testLogin(true, true, true); // Should pass
    
    // Rule 2: Invalid username -> Login failed
    testLogin(false, true, true); // Should fail
    
    // Rule 3: Invalid password -> Login failed
    testLogin(true, false, true); // Should fail
    
    // Rule 4: Account inactive -> Login failed
    testLogin(true, true, false); // Should fail
}Test your understanding of this topic:
Learn white box testing techniques that examine internal code structure and logic
Content by: Paras Dadhania
Software Testing & QA Specialist
// Statement Coverage
// Every line of code is executed at least once
function calculateGrade(score) {
    if (score >= 90) {        // Line 1
        return 'A';           // Line 2
    } else if (score >= 80) { // Line 3
        return 'B';           // Line 4
    } else if (score >= 70) { // Line 5
        return 'C';           // Line 6
    } else {                  // Line 7
        return 'F';           // Line 8
    }
}
// Test cases for 100% statement coverage
test('score 95 should return A', () => {
    expect(calculateGrade(95)).toBe('A'); // Covers lines 1, 2
});
test('score 85 should return B', () => {
    expect(calculateGrade(85)).toBe('B'); // Covers lines 1, 3, 4
});
test('score 75 should return C', () => {
    expect(calculateGrade(75)).toBe('C'); // Covers lines 1, 3, 5, 6
});
test('score 65 should return F', () => {
    expect(calculateGrade(65)).toBe('F'); // Covers lines 1, 3, 5, 7, 8
});
// Branch Coverage
// Every decision point is tested for both true and false
function validateUser(user) {
    if (user.age >= 18) {           // Branch 1: true/false
        if (user.email) {           // Branch 2: true/false
            return true;
        }
    }
    return false;
}
// Test all branch combinations
test('valid adult with email', () => {
    const user = { age: 25, email: 'test@example.com' };
    expect(validateUser(user)).toBe(true); // Branch 1: true, Branch 2: true
});
test('valid adult without email', () => {
    const user = { age: 25, email: null };
    expect(validateUser(user)).toBe(false); // Branch 1: true, Branch 2: false
});
test('minor with email', () => {
    const user = { age: 17, email: 'test@example.com' };
    expect(validateUser(user)).toBe(false); // Branch 1: false
});Test your understanding of this topic:
Master boundary value analysis to test edge cases and boundary conditions
Content by: Yash Sanghavi
Software Testing & QA Specialist
// Example: Age validation (18-65)
function testAgeBoundaries() {
    // Valid range: 18-65
    // Test boundaries: 17, 18, 19, 64, 65, 66
    
    // Just below minimum (invalid)
    expect(validateAge(17)).toBe(false);
    
    // Minimum valid
    expect(validateAge(18)).toBe(true);
    
    // Just above minimum (valid)
    expect(validateAge(19)).toBe(true);
    
    // Just below maximum (valid)
    expect(validateAge(64)).toBe(true);
    
    // Maximum valid
    expect(validateAge(65)).toBe(true);
    
    // Just above maximum (invalid)
    expect(validateAge(66)).toBe(false);
}
// Example: Password length (8-20 characters)
function testPasswordBoundaries() {
    // Valid range: 8-20 characters
    // Test boundaries: 7, 8, 9, 19, 20, 21
    
    // Just below minimum (invalid)
    expect(validatePassword("1234567")).toBe(false); // 7 chars
    
    // Minimum valid
    expect(validatePassword("12345678")).toBe(true); // 8 chars
    
    // Just above minimum (valid)
    expect(validatePassword("123456789")).toBe(true); // 9 chars
    
    // Just below maximum (valid)
    expect(validatePassword("1234567890123456789")).toBe(true); // 19 chars
    
    // Maximum valid
    expect(validatePassword("12345678901234567890")).toBe(true); // 20 chars
    
    // Just above maximum (invalid)
    expect(validatePassword("123456789012345678901")).toBe(false); // 21 chars
}
// Example: Array bounds
function testArrayBoundaries() {
    const arr = [1, 2, 3, 4, 5]; // Length: 5, valid indices: 0-4
    
    // Just below minimum (invalid)
    expect(() => arr[-1]).toThrow();
    
    // Minimum valid
    expect(arr[0]).toBe(1);
    
    // Just above minimum (valid)
    expect(arr[1]).toBe(2);
    
    // Just below maximum (valid)
    expect(arr[3]).toBe(4);
    
    // Maximum valid
    expect(arr[4]).toBe(5);
    
    // Just above maximum (invalid)
    expect(arr[5]).toBeUndefined();
}Test your understanding of this topic:
Learn equivalence partitioning to reduce test cases while maintaining coverage
Content by: Paras Dadhania
Software Testing & QA Specialist
// Example: Age validation (18-65)
function testAgeEquivalencePartitions() {
    // Valid partition: 18-65
    // Invalid partitions: <18, >65, non-numeric
    
    // Test one value from valid partition
    expect(validateAge(25)).toBe(true); // Representative of 18-65
    
    // Test one value from each invalid partition
    expect(validateAge(17)).toBe(false); // Representative of <18
    expect(validateAge(66)).toBe(false); // Representative of >65
    expect(validateAge("abc")).toBe(false); // Representative of non-numeric
}
// Example: Grade calculation
function testGradeEquivalencePartitions() {
    // A: 90-100
    // B: 80-89
    // C: 70-79
    // D: 60-69
    // F: 0-59
    // Invalid: <0, >100, non-numeric
    
    // Test one value from each valid partition
    expect(getGrade(95)).toBe('A'); // Representative of 90-100
    expect(getGrade(85)).toBe('B'); // Representative of 80-89
    expect(getGrade(75)).toBe('C'); // Representative of 70-79
    expect(getGrade(65)).toBe('D'); // Representative of 60-69
    expect(getGrade(55)).toBe('F'); // Representative of 0-59
    
    // Test invalid partitions
    expect(getGrade(-5)).toBe('Invalid'); // Representative of <0
    expect(getGrade(105)).toBe('Invalid'); // Representative of >100
    expect(getGrade("abc")).toBe('Invalid'); // Representative of non-numeric
}
// Example: Email validation
function testEmailEquivalencePartitions() {
    // Valid: proper email format
    // Invalid: missing @, missing domain, missing username, etc.
    
    // Test valid partition
    expect(validateEmail("user@example.com")).toBe(true);
    
    // Test invalid partitions
    expect(validateEmail("userexample.com")).toBe(false); // Missing @
    expect(validateEmail("@example.com")).toBe(false); // Missing username
    expect(validateEmail("user@")).toBe(false); // Missing domain
    expect(validateEmail("user@example")).toBe(false); // Missing TLD
    expect(validateEmail("")).toBe(false); // Empty string
}Test your understanding of this topic:
Continue your learning journey and master the next set of concepts.
Continue to Module 3