Skip to content

Testing

Jani Giannoudis edited this page Jul 30, 2023 · 22 revisions

Payroll Testing

The following test methods exist for testing the payroll

Test method Test scope Payroll Console JSON Extension
Case Available Test Test the case available actions and scripts CaseTest .ct.json
Case Build Test Test the case build actions and scripts CaseTest .ct.json
Case Validate Test Test the case validate actions and scripts CaseTest .ct.json
Payrun Test Test company payrun, all employees PayrunTest .pt.json
Payrun Employee Test Test employee payrun PayrunEmployeeTest .et.json
Report Build Test Test the report build scripts ReportTest .rt.json
Report Execute Test Test the report execute scripts ReportTest .rt.json
Payroll Testing

Case Testing

The following case test shows the validation of the salary lower limit from the start example.

Example Case Validation Test Test.Salary.ct.json:

1{
2  "$schema": "PayrollEngine.CaseTest.schema.json",
3  "testName": "Test.Salary",
4  "tenantIdentifier": "StartTenant",
5  "userIdentifier": "[email protected]",
6  "employeeIdentifier": "mario.nuñ[email protected]",
7  "payrollName": "StartPayroll",
8  "validateTests": [
9    {
10      "testName": "Employee.Salary.499.Test",                        
11      "input": {
12        "userIdentifier": "[email protected]",
13        "employeeIdentifier": "mario.nuñ[email protected]",
14        "divisionName": "StartDivision",
15        "case": {
16          "caseName": "Salary",
17          "values": [
18            {
19              "caseFieldName": "Salary",
20              "value": "499",
21              "start": "2023-02-01T00:00:00.0Z",
22              "created": "2023-02-15T18:22:45.0Z"
23            }
24          ]
25        }
26      },
27      "output": {
28        "issues": [
29          {
30            "caseFieldName": "Salary",
31            "issueType" : "CaseInvalid",
32            "number": 400
33          }
34        ]
35      }
36    },
37    {
38      "testName": "Employee.Salary.500.Test",
39      "input": {
40        "userIdentifier": "[email protected]",
41        "employeeIdentifier": "mario.nuñ[email protected]",
42        "divisionName": "StartDivision",
43        "case": {
44          "caseName": "Salary",
45          "values": [
46            {
47              "caseFieldName": "Salary",
48              "value": "500",
49              "start": "2023-02-01T00:00:00.0Z",
50              "created": "2023-02-15T18:22:45.0Z"
51            }
52          ]
53        }
54      },
55      "output": {
56        "values": [
57          {
58            "caseFieldName": "Salary",
59            "value": "500",
60            "start": "2023-02-01T00:00:00.0Z",
61            "created": "2023-02-15T18:22:45.0Z"
62          }
63        ]
64      }
65    }
66  ]
67}

The steps for testing the case in detail:

  • 2: Path to the JSON schema (adapt this to your local environment)
  • 10: Name for invalid salary test
  • 11-26: Invalid salary test input
  • 15-25: Invalid salary test case
  • 20: Invalid salary test case value 499
  • 27-35: Invalid salary test output
  • 31: Expected issue CaseInvalid
  • 32: Expected HTTP error code 400
  • 37-65: Valid salary test input
  • 43-53: Valid salary test case
  • 48: Valid salary test case value 500
  • 55-64: Valid salary test output
  • 59: Expected value 500

The command 5 Test.Salary.cmd runs the case test.

See also example Case Test.

Payrun Testing

The payrun test is available in two variants

  • Tenant payrun test - tenant exists only during the test
  • Employee payrun test - the test is performed on the copy of an employee.

Testing the payrun is described in the following examples

See also the Payrun tests.

Report Testing

In payroll reports, both report creation (report parameters) and report execution can be tested. The report tests can be defined by configuration (JSON) or by programming (C# with Client Services).

See Report Test

Clone this wiki locally