In this section, we will explore the crucial phase of test execution and the subsequent reporting process. This phase is where the actual testing of the software takes place, and the results are documented and analyzed. Understanding how to effectively execute tests and report findings is essential for ensuring software quality.

Key Concepts

  1. Test Execution:

    • The process of running the test cases on the software to verify that it behaves as expected.
    • Involves setting up the test environment, executing test scripts, and logging the outcomes.
  2. Test Reporting:

    • The documentation of the results of the test execution.
    • Includes details on passed and failed test cases, defects found, and overall software quality assessment.
  3. Defect Management:

    • Tracking and managing defects identified during test execution.
    • Involves logging defects, prioritizing them, and ensuring they are resolved.

Test Execution Process

  1. Preparation:

    • Ensure the test environment is set up correctly.
    • Verify that all necessary resources, such as test data and tools, are available.
  2. Execution:

    • Run the test cases as per the test plan.
    • Use automated tools or manual testing techniques as appropriate.
  3. Logging Results:

    • Record the outcome of each test case (pass/fail).
    • Capture any unexpected behavior or defects.
  4. Defect Reporting:

    • Document any defects found during testing.
    • Include steps to reproduce, severity, and any relevant screenshots or logs.

Test Reporting Process

  1. Test Summary Report:

    • A high-level overview of the test execution results.
    • Includes metrics such as the number of test cases executed, passed, failed, and blocked.
  2. Defect Report:

    • Detailed information on each defect found.
    • Includes defect ID, description, severity, status, and resolution.
  3. Test Metrics:

    • Quantitative measures to assess the quality of the software.
    • Examples include defect density, test coverage, and test execution rate.

Practical Example

Let's consider a simple example of a test execution and reporting process using a hypothetical login feature.

Test Case: Login Functionality

Objective: Verify that users can log in with valid credentials.

Steps:

  1. Navigate to the login page.
  2. Enter a valid username and password.
  3. Click the "Login" button.

Expected Result: User is redirected to the dashboard.

Execution

# Example of a simple automated test script using Python and Selenium

from selenium import webdriver

# Set up the WebDriver
driver = webdriver.Chrome()

try:
    # Navigate to the login page
    driver.get("http://example.com/login")

    # Enter valid credentials
    driver.find_element_by_id("username").send_keys("validUser")
    driver.find_element_by_id("password").send_keys("validPassword")

    # Click the login button
    driver.find_element_by_id("loginButton").click()

    # Verify the user is redirected to the dashboard
    assert "Dashboard" in driver.title
    print("Test Passed: User successfully logged in.")

except Exception as e:
    print(f"Test Failed: {e}")

finally:
    # Close the browser
    driver.quit()

Reporting

  • Test Summary:

    • Total Test Cases: 1
    • Passed: 1
    • Failed: 0
  • Defect Report: No defects found.

Exercise

Task: Write a test case for a "Forgot Password" feature and execute it using a similar approach as the example above. Document the results and any defects found.

Solution

Test Case: Forgot Password Functionality

Objective: Verify that users can reset their password using the "Forgot Password" feature.

Steps:

  1. Navigate to the login page.
  2. Click the "Forgot Password" link.
  3. Enter a registered email address.
  4. Submit the request.

Expected Result: A password reset email is sent to the user's email address.

Execution

# Example of a simple automated test script for "Forgot Password" feature

from selenium import webdriver

# Set up the WebDriver
driver = webdriver.Chrome()

try:
    # Navigate to the login page
    driver.get("http://example.com/login")

    # Click the "Forgot Password" link
    driver.find_element_by_link_text("Forgot Password").click()

    # Enter a registered email address
    driver.find_element_by_id("email").send_keys("[email protected]")

    # Submit the request
    driver.find_element_by_id("submitButton").click()

    # Verify the confirmation message
    assert "Password reset email sent" in driver.page_source
    print("Test Passed: Password reset email sent successfully.")

except Exception as e:
    print(f"Test Failed: {e}")

finally:
    # Close the browser
    driver.quit()

Reporting

  • Test Summary:

    • Total Test Cases: 1
    • Passed: 1
    • Failed: 0
  • Defect Report: No defects found.

Conclusion

In this section, we covered the essential aspects of test execution and reporting. By understanding how to effectively execute tests and document the results, you can ensure that software meets quality standards and is free of critical defects. This knowledge is foundational for any software testing professional and sets the stage for more advanced testing techniques.

© Copyright 2024. All rights reserved