Appearance
Are you an LLM? You can read better optimized documentation at /testing/e2e_testing.md for this page in Markdown format
End-to-end testing
This document provides a comprehensive technical overview of the end-to-end (E2E) testing strategy for TheExampleApp. E2E tests are designed to simulate real user scenarios by running the full application stack, from the browser client to the backend services, including the live integration with the Contentful CMS.
E2E testing setup
The E2E tests are located in the TheExampleApp.E2eTests project, which is part of the main solution file (TheExampleApp.sln:10). The project uses:
- Selenium WebDriver (version 3.7.0) for browser automation
- xUnit (version 2.3.1) as the test framework
- ChromeDriver for controlling the Chrome browser during test execution
The tests are written in C# and integrated into the .NET solution, allowing them to be run alongside unit tests and integration tests using standard .NET testing tools.
The tests require a running instance of the TheExampleApp web application to execute against. They are not self-hosting. For more details on running the application, see the Local Setup Guide.
A general overview of all testing types in this project can be found in the Testing Overview document.
Test framework configuration
The E2E test project is configured as a .NET Core 2.1 class library with the following key dependencies:
- Microsoft.NET.Test.Sdk (version 15.5.0) - Enables test discovery and execution
- Selenium.WebDriver (version 3.7.0) - Provides browser automation capabilities
- xUnit (version 2.3.1) - Testing framework for writing and organizing test cases
- xunit.runner.visualstudio (version 2.3.1) - Enables running tests within Visual Studio and via
dotnet test
The project includes ChromeDriver binaries (chromedriver and chromedriver.exe) that are automatically copied to the output directory during build, ensuring the tests can launch and control Chrome browser instances.
Running E2E tests
Local Execution
Before running E2E tests, ensure the application is built and running.
Build the Solution:
bashdotnet build1Start the Application: In a separate terminal, run the application:
bashdotnet run --project TheExampleApp1Refer to the Local Setup Guide for more details.
Execute E2E Tests: Once the application is running, execute the E2E tests using the .NET test runner:
bashdotnet test TheExampleApp.E2eTests1The tests will launch Chrome browser instances via Selenium WebDriver and interact with the running application to verify end-to-end functionality.
CI/CD Integration
The E2E test suite is integrated into the continuous integration pipeline:
- The solution is built, including the
TheExampleApp.E2eTestsproject - The application is started in the background
- E2E tests are executed using
dotnet test - The CI pipeline runs unit tests, integration tests, and E2E tests on every commit
For more information on the deployment pipeline, see the CI/CD Documentation.
Test Environment Setup
- Live Dependency: E2E tests run against a live, running instance of the application and real Contentful spaces. There is no mocking at this level of testing.
- Browser Requirements: The tests require Chrome browser and ChromeDriver to be available. The ChromeDriver binaries are included in the project and copied to the output directory during build.