Package org.fhirfrog.frog.tph
package org.fhirfrog.frog.tph
TestPlan Shorthand (TPH) — ANTLR4 parser, AST, and FHIR R5 TestPlan compiler.
This package implements a concise domain-specific language for authoring FHIR TestPlan resources. TPH files are parsed into an abstract syntax tree (AST) and compiled to FHIR R5 TestPlan JSON or XML.
Key Classes
TPHProcessor- Main entry point; parses a TPH source string or file and returns a compiled TestPlan resourceTPHCompiler- Walks the AST and produces a HAPI FHIR R5TestPlanmodel, serialisable to JSON or XMLTPHASTBuilder- ANTLR4 visitor that converts the parse tree into typed AST nodesTestPlanNode- Root AST node representing a complete TestPlan definitionTestCaseNode- AST node for a single test caseTestRunNode- AST node for a test run referenceTestDataNode- AST node for test data declarationsDependencyNode- AST node for dependency declarationsTPHErrorListener- ANTLR4 error listener that converts parse errors intoTPHParseExceptionTPHParseException- Thrown on syntax errors, including line and column information
Example TPH Syntax
TestPlan: AUCorePatientSuite
Title: "AU Core Patient Test Suite"
Status: #active
TestCase: PatientCRUD
TestRun: TestScript/au-core-patient-crud
TestCase: PatientSearch
Dependency: PatientCRUD
TestRun: TestScript/au-core-patient-search
Usage
TPHProcessor processor = new TPHProcessor();
String json = processor.processToJson(Path.of("au-core.tph"));
-
ClassDescriptionAST node representing a dependency.AST node representing a TestCase.AST node representing test data.AST node representing a TestPlan.AST node representing a test run.ANTLR visitor that builds AST from parse tree.Compiles TPH AST to FHIR TestPlan resources.Custom error listener that provides clear error messages with line numbers.Exception thrown when TPH parsing fails.Main entry point for parsing TPH files and compiling to FHIR TestPlan resources.