PayrollEngine.Client.Test
0.10.0-beta.1
dotnet add package PayrollEngine.Client.Test --version 0.10.0-beta.1
NuGet\Install-Package PayrollEngine.Client.Test -Version 0.10.0-beta.1
<PackageReference Include="PayrollEngine.Client.Test" Version="0.10.0-beta.1" />
<PackageVersion Include="PayrollEngine.Client.Test" Version="0.10.0-beta.1" />
<PackageReference Include="PayrollEngine.Client.Test" />
paket add PayrollEngine.Client.Test --version 0.10.0-beta.1
#r "nuget: PayrollEngine.Client.Test, 0.10.0-beta.1"
#:package PayrollEngine.Client.Test@0.10.0-beta.1
#addin nuget:?package=PayrollEngine.Client.Test&version=0.10.0-beta.1&prerelease
#tool nuget:?package=PayrollEngine.Client.Test&version=0.10.0-beta.1&prerelease
Payroll Engine Client Test
Part of the Payroll Engine open-source payroll automation framework. Full documentation at payrollengine.org.
Client library for testing Payroll Engine regulations and payrun results. Provides three test categories — Case, Payrun, and Report — each with dedicated runners, JSON schemas, and support for custom C# test extensions.
Test Categories
Case Test
Tests the case lifecycle in three phases:
| Phase | Runner | Description |
|---|---|---|
| Available | CaseAvailableTestRunner |
Verify case availability under given conditions |
| Build | CaseBuildTestRunner |
Verify computed field values after case build |
| Validate | CaseValidateTestRunner |
Verify validation rules on case input |
Test definition class: CaseTest — specifies tenant, user, payroll, optional employee, evaluation date, optional init cases, and lists of AvailableTests, BuildTests, and ValidateTests.
JSON schema: PayrollEngine.CaseTest.schema.json
Payrun Test
Tests payrun results for wage types, collectors, and custom results. Three runners cover different test scenarios:
| Runner | Description |
|---|---|
PayrunTestRunner |
Full cycle: imports exchange data, executes payrun, validates results, cleans up |
PayrunEmployeeTestRunner |
Runs on a copy of an existing employee — tenant data stays unchanged |
PayrunEmployeePreviewTestRunner |
Uses the preview endpoint — no data is persisted, no cleanup required |
All runners extend PayrunTestRunnerBase and accept a PayrunTestSettings configuration object.
Report Test
Tests report parameter handling and execution output in two phases:
| Phase | Runner | Description |
|---|---|---|
| Build | ReportBuildTestRunner |
Verify report parameters are built correctly |
| Execute | ReportExecuteTestRunner |
Verify report execution output |
Test definition class: ReportTest — specifies tenant, user, regulation, and lists of BuildTests and ExecuteTests.
JSON schema: PayrollEngine.ReportTest.schema.json
Test Settings
PayrunTestSettings controls payrun test behavior:
| Setting | Type | Default | Description |
|---|---|---|---|
TestPrecision |
TestPrecision |
TestPrecision2 |
Decimal places compared in result assertions |
ResultMode |
TestResultMode |
CleanTest |
Cleanup behavior after test run |
Owner |
string |
— | Optional owner tag applied to all payrun jobs |
ResultRetryDelay |
int |
1000 ms |
Polling interval for async payrun job completion |
ResultRetryCount |
int |
120 |
Maximum number of polling attempts |
TestResultMode
| Value | Description |
|---|---|
CleanTest |
Delete all test data after run (default) |
KeepFailedTest |
Keep data for failed tests to allow manual inspection |
KeepTest |
Keep all test data (manual cleanup required) |
TestPrecision
Numeric comparison precision from TestPrecisionOff (no rounding) to TestPrecision6 (6 decimal places). Default is TestPrecision2.
Custom Tests
All three test categories support custom C# test extensions. Custom tests are compiled at runtime from source files and invoked alongside the standard assertions.
Implement a custom test class with a constructor accepting PayrollHttpClient and the test context (CaseTestContext or ReportTestContext), and use Assert for assertions:
public class MyCustomTests(PayrollHttpClient httpClient, CaseTestContext context)
: CaseCustomTest(httpClient, context)
{
public void MyBuildTest(CaseBuildTest test)
{
Assert.AreEqual("ExpectedValue", test.BuildCase.Fields["MyField"].Value);
}
}
Register the source file in the test definition:
{
"customTestFiles": ["MyCustomTests.cs"],
"buildTests": [
{ "testName": "MyBuildTest", "caseName": "MyCaseName" }
]
}
JSON Schemas
The library generates two JSON schemas during build (requires PayrollEngineSchemaDir to be set):
| Schema | Root type |
|---|---|
PayrollEngine.CaseTest.schema.json |
CaseTest |
PayrollEngine.ReportTest.schema.json |
ReportTest |
Schemas are included in the NuGet package and can be referenced in test files for IDE validation:
{
"$schema": "../../Schemas/PayrollEngine.CaseTest.schema.json",
"testName": "MySalaryCaseTest",
...
}
Build
Environment variables used during build:
| Variable | Description |
|---|---|
PayrollEngineSchemaDir |
Output directory for generated JSON schemas (optional) |
PayrollEnginePackageDir |
Output directory for the NuGet package (optional) |
NuGet Package
Available on NuGet.org:
dotnet add package PayrollEngine.Client.Test
See Also
- Testing — test-driven payroll development
- Payroll Console — CLI runner for
.et.jsonand.pt.jsontest files - Client Services — SDK used by the test runners
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.CodeAnalysis.Compilers (>= 5.0.0)
- PayrollEngine.Client.Core (>= 0.10.0-beta.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on PayrollEngine.Client.Test:
| Package | Downloads |
|---|---|
|
PayrollEngine.Client.Services
Payroll Engine Client Services |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.10.0-beta.1 | 63 | 3/9/2026 |
| 0.9.0-beta.17 | 62 | 2/18/2026 |
| 0.9.0-beta.16 | 57 | 2/11/2026 |
| 0.9.0-beta.15 | 55 | 2/5/2026 |
| 0.9.0-beta.14 | 66 | 1/14/2026 |
| 0.9.0-beta.13 | 72 | 1/7/2026 |
| 0.9.0-beta.12 | 168 | 11/5/2025 |
| 0.9.0-beta.11 | 223 | 10/13/2025 |
| 0.9.0-beta.10 | 216 | 9/14/2025 |
| 0.9.0-beta.9 | 251 | 8/26/2025 |
| 0.9.0-beta.8 | 140 | 8/25/2025 |
| 0.9.0-beta.7 | 148 | 8/11/2025 |
| 0.9.0-beta.6 | 144 | 3/27/2025 |
| 0.9.0-beta.5 | 98 | 3/14/2025 |
| 0.9.0-beta.4 | 158 | 3/12/2025 |
| 0.9.0-beta.3 | 95 | 2/25/2025 |
| 0.9.0-beta.1 | 94 | 2/12/2025 |
| 0.8.0-beta.2 | 109 | 7/10/2024 |
| 0.8.0-beta.1 | 213 | 11/27/2023 |
| 0.6.0-beta.11 | 126 | 10/10/2023 |