Skip to content

Testing Guide

LevelScopeWho TestsExample
UnitSingle function/methodDeveloperTesting Add() in isolation
IntegrationMultiple components togetherQA/DeveloperDatabase + API working together
SystemEntire applicationQAEnd-to-end user workflows
AcceptanceBusiness requirements metCustomer/QAFeature meets acceptance criteria
TypeKnowledgeFocusWhen to Use
Black-BoxNo internal code knowledgeInputs/outputs, user perspectiveUser acceptance testing
White-BoxFull internal knowledgeCode paths, logic branchesUnit testing, debugging
Gray-BoxPartial internal knowledgeComponent behavior + external interactionIntegration testing
FunctionalDoes it work?Feature correctnessAll test levels
Non-FunctionalPerformance, security, usabilitySpeed, reliability, user experienceLoad/security/accessibility tests

Boundary Value Analysis: Test at the edges of input ranges (e.g., length = 0, 1, max-1, max).

Equivalence Partitioning: Divide inputs into groups that behave similarly; test one from each group.

Decision Table Testing: Map conditions to expected outcomes for complex business logic.

AspectTDDBDDGherkin
ApproachWrite test → Fail → Code → Pass → RefactorCollaboration-first; define behavior in plain languageDSL (Domain-Specific Language) for BDD
AudienceDevelopersTech + non-tech stakeholdersBusiness analysts, QA, developers
OutputUnit tests & codeExecutable specs & living documentationFeature files with scenarios
ToolsNUnit, xUnit, JUnit, PyTestCucumber, SpecFlow, BehaveGherkin syntax (used within BDD tools)
FocusImplementation qualityBehavior correctness & alignmentHuman-readable test definitions

Gherkin uses Given/When/Then/And/But to describe scenarios in plain language:

  • Given: Initial state or context
  • When: Action or event
  • Then: Expected outcome
  • And/But: Additional conditions (chains to any clause)

Example:

Feature: User login
Scenario: Successful login with valid credentials
Given the user is on the login page
When the user enters valid credentials
Then the user is redirected to the homepage
And a welcome message is displayed

Parameterization (testing multiple datasets):

Scenario Outline: Login with various roles
Given the user has role <role>
When the user logs in
Then they see the <dashboard> dashboard
Examples:
| role | dashboard |
| admin | Admin |
| user | User |
| guest | Guest |
[Test]
public void Should_AddTwoNumbers_Correctly()
{
var calculator = new Calculator();
var result = calculator.Add(2, 3);
Assert.AreEqual(5, result);
}

What to automate? Repetitive tests, multi-dataset scenarios, and high-effort manual tests. Avoid automating unstable features or tests that rarely run.

Tools & Languages:

ToolPrimary UseLanguage Support
SeleniumWeb automationJava, Python, C#, JS
PlaywrightModern web testingPython, JS, C#, Java
PostmanAPI testingBuilt-in scripting
SpecFlowBDD automation (.NET)C#
CucumberBDD automationJava, JS, Python, C#

Framework Types:

  • Data-Driven: Tests parameterized with external data (CSV, Excel, DB)
  • Keyword-Driven: Reusable keywords (abstraction layer over test steps)
  • Hybrid: Combines data-driven + keyword-driven
  • BDD: Gherkin-based automation (highest readability)

Maintenance is critical: Update tests as UI/APIs evolve, debug flaky tests quickly, and optimize suite runtime to avoid timeout nightmares.

Start with unit tests (fastest feedback loop). Move to integration tests once components interact. Add BDD when stakeholder alignment is critical. Reserve E2E automation for high-value, stable workflows. Measure test coverage but don’t obsess—100% coverage doesn’t guarantee bug-free code.


Questions? Explore SOLID & Code Quality, .NET Patterns, or Git Cheatsheet for more engineering guides.