TestPlan Shorthand (TPH)¶
TestPlan Shorthand (TPH) is a concise DSL for authoring FHIR TestPlan resources, in the same spirit as FHIR Shorthand (FSH) for profiles.
Experimental
TPH is under active development alongside the FHIR R5 TestPlan specification.
Why TPH?¶
A FHIR TestPlan JSON file for a simple 3-case suite is ~80 lines. The equivalent TPH is ~10 lines:
{
"resourceType": "TestPlan",
"id": "PatientSuite",
"title": "Patient API Test Suite",
"status": "active",
"testCase": [
{
"key": "PatientCreate",
"testRun": [
{ "script": { "reference": "TestScript/patient-create" } }
]
},
{
"key": "PatientRead",
"dependency": [
{ "predecessor": { "reference": "#PatientCreate" } }
],
"testRun": [
{ "script": { "reference": "TestScript/patient-read" } }
]
},
{
"key": "PatientDelete",
"dependency": [
{ "predecessor": { "reference": "#PatientRead" } }
],
"testRun": [
{ "script": { "reference": "TestScript/patient-delete" } }
]
}
]
}
Syntax Reference¶
TestPlan Header¶
TestPlan: <id>
Title: "<human-readable title>"
Description: "<optional description>"
Status: #<draft|active|retired>
Url: "http://example.org/TestPlan/<id>"
TestCase¶
Dependencies¶
Multiple dependencies:
TestData¶
Full Example¶
TestPlan: AUCorePatientSuite
Title: "AU Core Patient Test Suite"
Description: "Validates AU Core Patient profile conformance"
Status: #active
Url: "http://example.org/TestPlan/au-core-patient"
TestCase: PatientCreate
Title: "Create AU Core Patient"
TestRun: TestScript/au-core-patient-create
TestCase: PatientSearchByMedicare
Title: "Search by Medicare Number"
Dependency: PatientCreate
TestRun: TestScript/au-core-patient-search-medicare
TestCase: PatientSearchByIHI
Title: "Search by IHI"
Dependency: PatientCreate
TestRun: TestScript/au-core-patient-search-ihi
TestCase: PatientCleanup
Dependency: PatientSearchByMedicare
Dependency: PatientSearchByIHI
TestRun: TestScript/au-core-patient-delete
Using TPH Files¶
TPH files (.tph) are compiled to JSON at build time and used exactly like
hand-authored TestPlan JSON:
JUnit 5
@TestFactory
Stream<DynamicNode> auCore(FhirTestConfig config) {
return new TestPlanProvider(config).provide("au-core-patient.tph");
}
Next Steps¶
- JSON → TPH Migration — Convert existing TestPlans
- Dependencies — Dependency graph details
- TestPlan Expansion — How TPH is executed