Skip to content

Creating and maintaining E2E tests

Piotr Krajewski edited this page Nov 29, 2024 · 4 revisions

This page is designed to explain and guide testers and developers on how to approach writing and maintaining E2E tests effectively.


Table of Contents

  1. What are End-to-end Tests?
  2. Gather Requirements
  3. Add Tests in Azure Test Plan
  4. Writing E2E Tests
  5. Test Maintenance

What are End-to-end Tests?

"End-to-end testing is a technique that tests the entire software product from beginning to end to ensure the application flow behaves as expected. It defines the product’s system dependencies and ensures all integrated pieces work together as expected.

The main purpose of End-to-end (E2E) testing is to test from the end user’s experience by simulating real user scenarios and validating the system under test and its components for integration and data integrity."

To make the process of writing and maintaining test scenarios and automation scripts hassle-free, we should follow a specific process to ensure tests are written in the correct language and format.


Gather Requirements

Each test suite should be based on a set of requirements that ensures the quality of the feature. These requirements can be:

  • Written by the product owner as acceptance criteria.
  • Based on designs (e.g., Figma).

Once the requirements are clear, decide on the number of tests for both positive and negative scenarios, and write down the test titles.

Actions:

  • Check with the product owner for acceptance criteria.
  • List the titles of test cases that will cover the feature.

Add Tests in Azure Test Plan

Before you start adding tests in Azure Test Plan, ensure that the relevant test suite is created within the test plan. You can create a test suite by:

  1. Clicking the three dots next to the relevant suite (if it already exists).
  2. Selecting “New Suite” > “Static Suite”.
  3. Giving it an appropriate name.
Add new test suite

Modes of Adding Tests

There are two modes for adding tests in Azure Test Plan:

  1. “Grid” Mode: Best for adding multiple tests at once.
Screenshot 2024-11-28 at 5 52 13 PM
Screenshot 2024-11-28 at 5 53 55 PM
  1. “New Test Case” Mode: Ideal for adding individual tests one at a time.
Screenshot 2024-11-28 at 5 55 37 PM

Rules for Adding New Test Cases

When adding test cases, ensure the following:

  • Titles: Keep the title relevant and self-explanatory.
  • Language: Write test scenarios in Gherkin language. This makes them more translatable to code and easier for testers to execute manually.
  • State: Mark the test case as “Draft” when work is in progress and “Ready” when finalized for execution or automation.
  • Tags: Always add relevant tags related to the feature or project.

Tag Examples

  • General Tags: to be automated, automated, api, k6, manual.
  • Project Tags: Portalicious, safaricom, intersolve, etc.

If an E2E test is going to be automated and relates to Portalicious, use tags like to be automated and Portalicious. Once automated, update the tag to automated.

Screenshot 2024-11-28 at 6 07 28 PM

Example of tagging for k6 test:

Screenshot 2024-11-28 at 6 08 19 PM

Formatting Tips

  • If adding test cases directly in Azure Test Plan, formatting issues are rare.
  • If copying from external sources, such as a document with a dark background:
    1. Paste the content into a plain-text editor (e.g., Word, Pages).
    2. Remove any background colors.
    3. Adjust the text color for readability on both light and dark backgrounds (e.g., use blue like #1175FF).

Linking Test Cases

When possible link test cases to relevant PBIs, Tasks, or Bugs.

You can do so in two different ways:

  1. From the test case: Attach the PBI under the “Tests” field.
Screenshot 2024-11-28 at 6 16 25 PM
  1. From the PBI: Attach the test case under “Tested by”.
Screenshot 2024-11-28 at 6 17 12 PM

This helps testers understand which tests to work on during feature implementation.


Writing E2E Tests

Most readers of this guide are likely familiar with writing automated tests. You can find more information here. However, one crucial point to emphasize is adding relevant Test IDs to test titles.

Why Add Test IDs?

  • Makes it easier to locate and edit tests.
  • Simplifies validation of scenarios in case of test failures.
  • Facilitates generating test reports in Azure Test Plan.
test('[27493] Navigate to programme', async ({ page }) => {
  const homePage = new HomePage(page);

  await test.step('Should open PAs for registration', async () => {
    await homePage.navigateToProgramme(NLRCProgram.titlePortal.en);
  });
});

Test Maintenance

Keeping tests up-to-date is essential for a well-functioning testing process.

To Update a Test:

  1. Open the correct test suite.
  2. Open the test case.
  3. Edit the content as needed and save it.

To Remove a Test:

  • If a test case is no longer relevant:
    • Delete it from the test suite.
    • If automated, create a PR to remove the corresponding E2E test script.

To search for specific test cases or suites:

  1. Select queries
  2. Work item type "Test Case" or "Test suite"
  3. Add additional clauses
  4. "Run query"
Screenshot 2024-11-28 at 6 40 58 PM
Clone this wiki locally