This document defines the requirements for a YAML‑driven API testing tool implemented in .NET.
The application allows developers to define API test cases using YAML configuration files and run those tests using a .NET executable. Test results are displayed through a local web dashboard launched automatically when the tool runs.
The goal is to provide a lightweight, configurable API test runner similar to Postman/Newman but fully scriptable through YAML and executable locally.
The system must:
- Execute API tests defined in YAML files
- Support testing multiple APIs across multiple environments
- Allow validation of response fields including:
- strings
- objects
- arrays of objects
- Provide a web dashboard showing test status
- Run from a single .NET executable
- Allow tests to be written without writing code
- Allow configuration through
appsettings.json
Executable (.NET) | ├── YAML Loader | ├── Test Execution Engine | ├── HTTP Request Builder | ├── Assertion Engine | └── Result Collector | └── Web Dashboard (ASP.NET Core) └── Displays test results
Test cases must be defined in YAML files.
The runner will:
- Load YAML configuration
- Build HTTP requests
- Execute requests
- Validate responses
- Display results
The YAML must support multiple environments.
Example:
environments:
- name: Local
baseUrl: https://localhost:7001
- name: UAT
baseUrl: https://uat-api.company.comEach environment defines a base URL used by its endpoints.
Each environment can contain multiple endpoints.
Example:
endpoints:
- name: Get Accounts
method: GET
path: /api/accountsRequired fields:
| Field | Description |
|---|---|
| name | Display name |
| method | HTTP method |
| path | API path |
Supported methods:
GET, POST, PUT, PATCH, DELETE
path: /api/customers/{customerId}
pathParams:
customerId: C1001query:
page: 1
pageSize: 50Produces:
/api/accounts?page=1&pageSize=50
headers:
Authorization: Bearer token
Content-Type: application/jsonbody:
customerId: C1001
currency: SGD
items:
- productCode: FUND1
amount: 1000Each endpoint can contain one or more tests.
tests:
- name: Accounts should exist
expectedStatus: 200Assertions validate response fields.
Field paths use dot notation.
Example:
data.accounts[0].accountNo
Example assertion:
assertions:
- field: success
equals: true
- field: message
containsText: success
- field: data.accounts
type: array
minCount: 1equals: valuenotEquals: valueSupported types:
- string
- number
- boolean
- object
- array
Example:
type: objectSupported:
- containsText
- startsWith
- endsWith
- notEmpty
Example:
containsText: successSupported:
- minCount
- maxCount
- count
Example:
minCount: 1Example:
assertions:
- field: data.accounts
contains:
status: ActiveMeaning at least one element in the array must match.
environments:
- name: Local
baseUrl: https://localhost:7001
endpoints:
- name: Login
method: POST
path: /api/auth/login
headers:
Content-Type: application/json
body:
username: testuser
password: password123
tests:
- name: Login should succeed
expectedStatus: 200
assertions:
- field: success
equals: true
- field: data.token
type: string
notEmpty: true
- name: Get Accounts
method: GET
path: /api/accounts
query:
customerId: C1001
tests:
- name: Accounts should exist
expectedStatus: 200
assertions:
- field: data.accounts
type: array
minCount: 1
- field: data.accounts
contains:
status: ActiveWhen the executable starts:
- Local web server starts
- Browser opens automatically
Example URL:
Dashboard displays:
- environments
- endpoints
- pass/fail status
- error messages
- execution time
Example:
Environment: Local
✔ Login
✔ Get Accounts
Summary
Total Tests: 2
Passed: 2
Failed: 0
The web dashboard port must be configurable through appsettings.json.
Example:
{
"WebServer": {
"Host": "localhost",
"Port": 5005,
"AutoLaunchBrowser": true
}
}Configuration fields:
| Field | Description |
|---|---|
| Host | Host binding |
| Port | Web dashboard port |
| AutoLaunchBrowser | Automatically open browser |
Load YAML
↓
Initialize environment
↓
Build HTTP request
↓
Execute API call
↓
Parse response JSON
↓
Run assertions
↓
Store results
↓
Display dashboard
| Component | Technology |
|---|---|
| Runtime | .NET 8 |
| YAML Parser | YamlDotNet |
| HTTP Client | HttpClient |
| JSON Parsing | System.Text.Json |
| Web Dashboard | ASP.NET Core |
| Frontend | HTML + JavaScript |
Performance:
- Must support concurrent endpoint execution
Logging:
Must log:
- requests
- responses
- assertion failures
Extensibility:
Future features should support authentication flows, retries, CI/CD integration, and scheduling.
These features are not required for the first version but should be considered for future development.
Real-time dashboard updates using SignalR or WebSockets.
Example:
ApiTestRunner.exe --env UAT
Run specific tests by tag.
Example:
ApiTestRunner.exe --tag smoke
Extract values from responses.
Example:
capture: token: data.token
Reuse:
Authorization: Bearer {{token}}
Allow configuration such as:
parallel: true
maxConcurrency: 5
Support CI mode:
ApiTestRunner.exe --ci
Output formats:
- JSON
- JUnit XML
- HTML
Support automated scheduled health checks.
Historical reports, response time tracking, and trend analysis.
Support OAuth2, JWT acquisition, and API key flows.
Allow custom assertions and request processors.
The tool is considered successful when:
- Tests can be written purely in YAML
- No code changes are required to add new endpoints
- Test results are visible via the dashboard
- Developers can run the tests with a single executable