Skip to content

TestScript Shorthand (TSH)

TSH is a concise domain-specific language for authoring FHIR TestScripts — 70–80% fewer lines than JSON, designed to feel natural alongside FSH profiles.

Why TSH?

JSON TestScript is verbose. A single assert requires 5–7 lines of nesting. TSH collapses that to one readable line:

* assert ServiceRequest.status = "active"
{
  "assert": {
    "description": "Status is active",
    "expression": "ServiceRequest.status",
    "value": "active",
    "operator": "equals",
    "warningOnly": false
  }
}

Syntax at a Glance

TestScript: PatientCreate
Title: "Create AU Core Patient"
Status: #draft

Fixture: patient from "fixtures/patient.json"

Setup:
  * operation create Patient from patient as created
  * assert response = created
  * variable patientId = Patient.id from created

Test: "Read the created patient"
  * operation read Patient/${patientId} as readResult
  * assert response = okay
  * assert Patient.name.family = "Smith"

Teardown:
  * operation delete Patient/${patientId}

Key Concepts

TSH Meaning
Fixture: x from "file.json" Load a fixture resource
* operation create T from x as r POST resource T using fixture x, store response as r
* operation read T/${id} as r GET resource T by id
* assert response = okay Assert HTTP 200
* assert response = created Assert HTTP 201
* assert T.path = "value" FHIRPath assertion
* variable name = T.path from r Extract variable from response

Roadmap

TSH is designed to eventually merge into FHIR Shorthand (FSH) as a native testing syntax, so tests and profiles live in the same .fsh files with a consistent authoring experience.

Next Steps