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 resource
  • TPHCompiler - Walks the AST and produces a HAPI FHIR R5 TestPlan model, serialisable to JSON or XML
  • TPHASTBuilder - ANTLR4 visitor that converts the parse tree into typed AST nodes
  • TestPlanNode - Root AST node representing a complete TestPlan definition
  • TestCaseNode - AST node for a single test case
  • TestRunNode - AST node for a test run reference
  • TestDataNode - AST node for test data declarations
  • DependencyNode - AST node for dependency declarations
  • TPHErrorListener - ANTLR4 error listener that converts parse errors into TPHParseException
  • TPHParseException - 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"));