Markop Test provides four primary factory abstractions. This page explains when and how to use each one.
Base class: UnitTestFactory<TStartup>
Use unit tests to verify isolated behavior while still leveraging DI and host-level setup.
- Extension methods and utility logic
- Domain services with mocked dependencies
- Data transformation and validation routines
Initializer(IServiceProvider hostServices)ConfigureTestServices(IServiceCollection services)
Base class: IntegrationTestFactory<TStartup, TFetchOptions>
Use integration tests to validate API endpoints, middleware, request/response contracts, and persistence behavior.
- API contract validation
- Authentication and authorization flows
- Persistence and transaction behavior
GetUrl(string url, string controllerName, string testMethodName)Initializer(IServiceProvider hostServices)ConfigureTestServices(IServiceCollection services)ValidateResponse(HttpResponseMessage response, TFetchOptions options)
Get(query, fetchOptions)Post(query, content, fetchOptions)Put(query, content, fetchOptions)Patch(query, content, fetchOptions)Delete(query, fetchOptions)PostJson(body, query, fetchOptions)PutJson(body, query, fetchOptions)PatchJson(body, query, fetchOptions)
Base class: FunctionalTestFactory<TStartup>
Use functional tests for complete user/business scenarios that combine multiple operations.
- Multi-step workflows (create, edit, delete)
- Role-based system behavior across multiple endpoints
- Business acceptance scenarios
Initializer(IServiceProvider hostServices)ConfigureTestServices(IServiceCollection services)
GetClient()lets you construct scenario flows using integration test classes or direct HTTP calls.
Base class: LoadTestFactory<TStartup>
Use load tests to compare endpoint performance under synchronous and asynchronous traffic.
- Throughput baseline checks
- Endpoint latency regression checks
- Capacity trend monitoring
Initializer(IServiceProvider hostServices)ConfigureTestServices(IServiceCollection services)GetUrl(string url, string controllerName, string testMethodName)
Post(content)Put(content)Patch(content)PostJson(data)PutJson(data)PatchJson(data)
Load test execution writes an HTML-based report to a folder under LoadTestResult/.