Class TestPackageExecutor

java.lang.Object
org.fhirfrog.frog.junit.TestPackageExecutor

public class TestPackageExecutor extends Object
Executes every TestScript (or the single TestPlan closure) discovered in a resolved Test IG package - "<id>#<version>", e.g. "fhirfrog.au-core-tests#0.1.0" - reusing ProgrammaticTestExecutor's existing single-file execution for each discovered file rather than duplicating TestScriptEngine/TestPlanProvider wiring.

The bundle-discovery logic below (flat-vs-TestPlan detection, *.json listing) ports frog-runner's own private RunService equivalent (that project's downstream web UI) - fhir-frog itself never had a shared, reusable version of it. This class is that shared version, so fhir-frog-cli/-ant/-maven-plugin can each gain Test IG package support without duplicating this decision three times.

  • Constructor Details

    • TestPackageExecutor

      public TestPackageExecutor() throws IOException
      Throws:
      IOException
    • TestPackageExecutor

      public TestPackageExecutor(org.fhirfrog.frog.internal.testscript.TestPackageResolver testPackageResolver, ProgrammaticTestExecutor executor)
      Resolver/executor-injecting overload, public specifically so a consumer's own tests can point package resolution at an isolated cache folder instead of the real shared ~/.fhir/packages - same rationale as TestPackageResolver's own overload.
  • Method Details

    • executeTestPackage

      public JUnitExecutor.ExecutionResult executeTestPackage(String testPackage, String serverUrl, String igPackage, String remoteTerminologyServerUrl) throws IOException
      Parameters:
      testPackage - "<id>#<version>" of a Test IG package to resolve and execute
      serverUrl - FHIR server under test
      igPackage - "<id>#<version>" to validate validateProfileId assertions against, or null to skip - only honoured for a flat (multi- TestScript) package; a TestPlan-shaped package's own ProgrammaticTestExecutor.executeTestPlan(java.lang.String, java.lang.String, java.nio.file.Path) has no equivalent parameter yet (an existing asymmetry vs. executeTestScript, not introduced here).
      remoteTerminologyServerUrl - external FHIR terminology server, or null to skip - same flat-bundle-only caveat as igPackage above.
      Returns:
      every discovered TestScript's results merged into one JUnitExecutor.ExecutionResult (success true only if every one passed, failures/testResults concatenated across all of them) for a flat package, or exactly what executeTestPlan itself returns for a TestPlan one.
      Throws:
      IllegalArgumentException - if the package contains no TestScript *.json files
      IOException - if the package can't be resolved