Software Testing - Chapter 3: Executing Test Cases with Examples

          Welcome to Chapter 3 of our software testing journey, where we'll explore the crucial process of executing test cases. In this chapter, we'll guide you through the practical aspects of running your test cases, and we'll provide real-world examples to help you understand how it all works. Plus, we'll share valuable website links to deepen your knowledge.



Why Test Case Execution Matters


Executing test cases is the moment of truth in software testing. It's where you verify whether your software functions correctly and meets the desired quality standards. Let's dive into the process.


Test Case Execution Process


Example 1: Manual Testing of a Login Page


Suppose you're testing a web application's login functionality manually. Here's a step-by-step example:


Launch the Application:

Open a web browser and navigate to the login page of the application.


Enter Credentials:

Enter valid username and password into the respective fields.


Click the Login Button:

Click the "Login" button to submit the credentials.


Verify Login:

After submitting, verify that you are redirected to the user dashboard or home page. Additionally, check for any error messages if the login fails.


Logout:

If needed, log out from the application to return to the login page.


Repeat for Edge Cases:

Perform similar tests with invalid credentials, empty fields, and other edge cases.


 Example 2: Automated Testing with Selenium


If you've automated your testing using Selenium WebDriver (as discussed in Chapter 2), running test cases becomes more efficient. Here's how you would execute an automated test case for a login page:


```python

# Sample Python code for Selenium WebDriver login test


from selenium import webdriver


# Initialize the WebDriver

driver = webdriver.Chrome()

driver.get("https://example.com/login")


# Locate and interact with web elements

driver.find_element_by_id("username").send_keys("your_username")

driver.find_element_by_id("password").send_keys("your_password")

driver.find_element_by_id("login-button").click()


# Assertions to verify the expected results

assert "User Dashboard" in driver.title


# Close the browser

driver.close()

```

Website Link 1:

SeleniumHQDocumentation https://www.selenium.dev/documentation/en/ - This official documentation provides detailed information on using Selenium WebDriver for test automation.


Reporting Test Results


After executing test cases, it's crucial to report the results. Tools like TestNG, JUnit, or custom reporting libraries can help generate detailed reports with pass/fail status, logs, and screenshots.


Conclusion


Executing test cases is where you put your software through its paces and ensure it functions correctly. In this chapter, we explored both manual and automated test case execution with practical examples. By following the steps and examples provided, you're well-equipped to start testing your own software projects.


For more advanced techniques and insights into test execution, explore the provided website links. In the next chapters, we'll delve deeper into test automation and advanced testing scenarios. Stay tuned for more exciting insights on your software testing journey!


For More : Click Here



Post a Comment

0 Comments