Programming: Software Quality Assurance Techniques

Course Overview

  • Course Title: Programming: Software Quality Assurance Techniques
  • Instructor: Sumit Dhameliya
  • Contact: sdhameliya@conestogac.on.ca
  • Term: Winter 2025

Unit Testing

  • Definition: Tests small units or modules of a software system.
  • Focus: Individual classes or small components.
  • Characteristics:
    • Fully automated
    • Easy to develop using frameworks like NUnit
    • Execute quickly
    • Provide good test coverage

Integration Testing

  • Purpose: Tests modules working together.
  • Importance: Individual module tests do not guarantee that integrated components work correctly as a complete system.
  • System Testing:
    • Term used for testing the entire system.
    • Different from acceptance testing.

Testing Levels

System Testing
  • Scope:
    • Includes various types of testing such as functionality, performance, and load testing.
  • Contrast with Unit Testing:
    • Unit testing focuses on individual components while system testing evaluates the complete application.
Comparison of System and Unit Testing
  • Unit Testing: Tests one class or small component.
  • System Testing: Tests the entire application, including interactions between components.

Selenium Overview

  • Definition: Selenium WebDriver is a robust tool for test automation.
  • Languages Supported: C#, Java, Ruby, etc.
  • Type: Free, open-source software.
Selenium IDE
  • Functionality: Interactive record-and-playback tool
  • Purpose: Allows users to record tests in a convenient way.

Chairing Tests in C# with Selenium

Set Up
  • Framework: NUnit for organizing test cases
  • WebDriver API: Provides methods to interact with the browser (navigating, finding elements, simulating user actions).
Example Code Snippet
[TearDown]
public void TeardownTest()
{
    driver.Quit();
}
  • Important: Always quit WebDriver after tests.

Using Selenium IDE

  • Installation:
    • Install in Firefox (extension not available in Chrome).
  • Recording a Test:
    • Record actions performed on the webpage.
    • Save and execute the test.

Adding Assertions to Selenium Tests

  • Assertions:
    • Essential for validating test results.
    • Example: To check for text, add an assert command to specify target and expected value.
Steps for Running Tests With Assertions
  1. Record actions.
  2. Insert assert statements based on expected outcomes.
  3. Execute the tests and check for pass/fail results.

Referencing Web Elements

  • Tools Used: Developer tools (F12) allow locating elements on a page.
  • Methods:
    • Using XPATH, By.Name, or By.Id for referencing elements.

Developing Web Tests - Guidelines

  1. Navigate to URL: driver.Navigate().GoToUrl(baseURL);
  2. Find the element: driver.FindElement(...);
  3. Perform assertion: Assert.IsTrue(...);
  4. Close the browser: driver.Close();
  5. Follow the Arrange-Act-Assert format for structuring code.

Running Tests

  • Environment: Use Testing framework like NUnit or Visual Studio Test Explorer
  • Management: Ensure appropriate naming conventions for tests for clarity and organization.

Practical Application

  • Project: Develop automation tests for practice site: https://coffee-cart.app/
  • Reflections: Compare time spent on manual testing vs. automated test development.

Conclusion

  • Continuous practice and exploration with tools like Selenium are essential for mastering automated testing.
  • Always strive to validate each and every web element as part of testing.