Roadmap › 5. Automation & Industry 4.0 › Step 52
QA
Test Automation — Selenium, Playwright, API and BDD with C#
Testing fundamentals and the test pyramid, NUnit/xUnit, Selenium WebDriver and locators, waits, Page Object Model, Playwright for .NET, API testing with HttpClient/RestSharp/Postman, BDD with Reqnroll (SpecFlow), data-driven tests, CI pipelines, flaky tests and the SDET interview questions.
What it is & where it is used
Test automation means writing code that tests software automatically and repeatably — UI tests that drive a browser, API tests that call endpoints, and unit/integration tests that check code directly. An SDET (Software Development Engineer in Test) or automation engineer builds and maintains these frameworks and runs them in CI/CD.
The test pyramid (Mike Cohn):
text
/ UI / E2E \ few — slow, brittle, test real user flows
/ API / service \ more — fast, stable, test business rules through the API
/ Unit tests \ most — milliseconds, test classes/functions in isolation| Level | Tools (.NET) | Speed |
|---|---|---|
| Unit | xUnit, NUnit, MSTest + Moq/NSubstitute + FluentAssertions | ms |
| Integration | WebApplicationFactory, Testcontainers, EF Core with real SQL | seconds |
| API | HttpClient, RestSharp, Postman/Newman, Playwright API | seconds |
| UI / E2E | Selenium WebDriver, Playwright, Cypress (JS) | seconds–minutes |
| BDD | Reqnroll (successor of SpecFlow), Cucumber | wraps any level |
| Performance | k6, JMeter, NBomber, Azure Load Testing | minutes |
Versions & history
| Year | Milestone |
|---|---|
| 2004 | Selenium created at ThoughtWorks (Jason Huggins) |
| 2011 | Selenium 2 merges WebDriver |
| 2016 | Selenium 3 (Selenium RC removed) |
| 2018 | WebDriver becomes a W3C Recommendation |
| 2020 | Playwright released by Microsoft (Node), .NET/Python/Java bindings in 2021 |
| 2021 | Selenium 4 — W3C protocol, relative locators, CDP access, new Grid |
| 2023 | Selenium Manager (automatic driver download) built in from 4.6+ |
| 2024 | SpecFlow end-of-life announced; community fork Reqnroll becomes the .NET BDD standard; WebDriver BiDi rolling out |
| 2025 | Playwright 1.5x — test agents, MCP integration; Selenium 4.3x with BiDi APIs |
Lifecycle
Automation in the software testing life cycle (STLC):
- Requirement analysis — which acceptance criteria can be automated; risk-based selection.
- Test planning — scope, tools, framework design, environments, data strategy.
- Test design — test cases, data sets, page objects, API contracts.
- Framework & scripts — build reusable framework, write tests, code review them like product code.
- Execution — locally and in CI (on every PR: unit + API smoke; nightly: full regression; parallel/grid).
- Reporting — results, screenshots, videos, traces (Allure, ExtentReports, Azure Test Plans, Playwright HTML report).
- Maintenance — fix flaky tests, update locators, refactor; delete tests that no longer give value.
Tools used to develop
- Test runners: NUnit, xUnit, MSTest;
dotnet test. - UI: Selenium WebDriver (C#), Playwright for .NET (
Microsoft.Playwright), Appium (mobile), WinAppDriver/FlaUI (Windows desktop). - API: HttpClient, RestSharp, Flurl, Postman + Newman, Playwright
APIRequestContext. - BDD: Reqnroll (Gherkin
.featurefiles with C# step definitions). - Assertions & mocks: FluentAssertions / Shouldly, Moq, NSubstitute, WireMock.Net (fake HTTP services).
- Data & environments: Bogus (fake data), Testcontainers (Docker DBs), Selenium Grid / Selenoid, BrowserStack, Sauce Labs.
- CI & reporting: Azure DevOps, GitHub Actions, Jenkins, Allure, ExtentReports.