Release 5

This page is part of the FHIR Specification (v5.0.0: R5 - STU). This is the current published version in it's permanent home (it will always be available at this URL). For a full list of available versions, see the Directory of published versions

Testplan.shex

FHIR Infrastructure Work GroupMaturity Level: N/AStandards Status: InformativeCompartments: No defined compartments

Raw ShEx

ShEx statement for testplan

PREFIX fhir: <http://hl7.org/fhir/> 
PREFIX fhirvs: <http://hl7.org/fhir/ValueSet/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 

IMPORT <uri.shex>
IMPORT <code.shex>
IMPORT <string.shex>
IMPORT <Coding.shex>
IMPORT <boolean.shex>
IMPORT <integer.shex>
IMPORT <dateTime.shex>
IMPORT <markdown.shex>
IMPORT <Reference.shex>
IMPORT <Identifier.shex>
IMPORT <UsageContext.shex>
IMPORT <ContactDetail.shex>
IMPORT <DomainResource.shex>
IMPORT <CodeableConcept.shex>
IMPORT <BackboneElement.shex>
IMPORT <CodeableReference.shex>


start=@<TestPlan> AND {fhir:nodeRole [fhir:treeRoot]}

# Description of intented testing
<TestPlan> EXTENDS @<DomainResource> CLOSED {   

    a [fhir:TestPlan]?;
    fhir:nodeRole [fhir:treeRoot]?;

    fhir:url @<uri>?;                       # Canonical identifier for this test 
                                            # plan, represented as a URI 
                                            # (globally unique) 
    fhir:identifier @<OneOrMore_Identifier>?;  # Business identifier identifier for 
                                            # the test plan 
    fhir:version @<string>?;                # Business version of the test plan
    fhir:versionAlgorithm @<string>  OR 
    			@<Coding>  ?;  # How to compare versions
    fhir:name @<string>?;                   # Name for this test plan (computer 
                                            # friendly) 
    fhir:title @<string>?;                  # Name for this test plan (human 
                                            # friendly) 
    fhir:status @<code> AND
    	{fhir:v @fhirvs:publication-status};  # draft | active | retired | unknown
    fhir:experimental @<boolean>?;          # For testing purposes, not real 
                                            # usage 
    fhir:date @<dateTime>?;                 # Date last changed
    fhir:publisher @<string>?;              # Name of the publisher/steward 
                                            # (organization or individual) 
    fhir:contact @<OneOrMore_ContactDetail>?;  # Contact details for the publisher
    fhir:description @<markdown>?;          # Natural language description of 
                                            # the test plan 
    fhir:useContext @<OneOrMore_UsageContext>?;  # The context that the content is 
                                            # intended to support 
    fhir:jurisdiction @<OneOrMore_CodeableConcept>?;  # Intended jurisdiction where the 
                                            # test plan applies (if applicable) 
    fhir:purpose @<markdown>?;              # Why this test plan is defined
    fhir:copyright @<markdown>?;            # Use and/or publishing restrictions
    fhir:copyrightLabel @<string>?;         # Copyright holder and year(s)
    fhir:category @<OneOrMore_CodeableConcept>?;  # The category of the Test Plan - 
                                            # can be acceptance, unit, 
                                            # performance 
    fhir:scope @<OneOrMore_Reference>?;     # What is being tested with this 
                                            # Test Plan - a conformance 
                                            # resource, or narrative criteria, 
                                            # or an external reference 
    fhir:testTools @<markdown>?;            # A description of test tools to be 
                                            # used in the test plan - narrative 
                                            # for now 
    fhir:dependency @<OneOrMore_TestPlan.dependency>?;  # The required criteria to execute 
                                            # the test plan - e.g. 
                                            # preconditions, previous tests 
    fhir:exitCriteria @<markdown>?;         # The threshold or criteria for the 
                                            # test plan to be considered 
                                            # successfully executed - narrative 
    fhir:testCase @<OneOrMore_TestPlan.testCase>?;  # The test cases that constitute 
                                            # this plan 
}  

# The test cases in a structured language e.g. gherkin, Postman, or FHIR TestScript
<TestPlan.testCase.testRun.script> EXTENDS @<BackboneElement> CLOSED {   
    fhir:language @<CodeableConcept>?;      # The language for the test cases 
                                            # e.g. 'gherkin', 'testscript' 
    fhir:source @<string>  OR 
    			@<Reference>  ?;  # The actual content of the cases - 
                                            # references to TestScripts or 
                                            # externally defined content 
}  

# The test cases that constitute this plan
<TestPlan.testCase> EXTENDS @<BackboneElement> CLOSED {   
    fhir:sequence @<integer>?;              # Sequence of test case in the test 
                                            # plan 
    fhir:scope @<OneOrMore_Reference>?;     # The scope or artifact covered by 
                                            # the case 
    fhir:dependency @<OneOrMore_TestPlan.testCase.dependency>?;  # Required criteria to execute the 
                                            # test case 
    fhir:testRun @<OneOrMore_TestPlan.testCase.testRun>?;  # The actual test to be executed
    fhir:testData @<OneOrMore_TestPlan.testCase.testData>?;  # The test data used in the test case
    fhir:assertion @<OneOrMore_TestPlan.testCase.assertion>?;  # Test assertions or expectations
}  

# The test data used in the test case
<TestPlan.testCase.testData> EXTENDS @<BackboneElement> CLOSED {   
    fhir:type @<Coding>;                    # The type of test data description, 
                                            # e.g. 'synthea' 
    fhir:content @<Reference>?;             # The actual test resources when 
                                            # they exist 
    fhir:source @<string>  OR 
    			@<Reference>  ?;  # Pointer to a definition of test 
                                            # resources - narrative or 
                                            # structured e.g. synthetic data 
                                            # generation, etc 
}  

# The required criteria to execute the test plan - e.g. preconditions, previous tests
<TestPlan.dependency> EXTENDS @<BackboneElement> CLOSED {   
    fhir:description @<markdown>?;          # Description of the dependency 
                                            # criterium 
    fhir:predecessor @<Reference>?;         # Link to predecessor test plans
}  

# Required criteria to execute the test case
<TestPlan.testCase.dependency> EXTENDS @<BackboneElement> CLOSED {   
    fhir:description @<markdown>?;          # Description of the criteria
    fhir:predecessor @<Reference>?;         # Link to predecessor test plans
}  

# The actual test to be executed
<TestPlan.testCase.testRun> EXTENDS @<BackboneElement> CLOSED {   
    fhir:narrative @<markdown>?;            # The narrative description of the 
                                            # tests 
    fhir:script @<TestPlan.testCase.testRun.script>?;  # The test cases in a structured 
                                            # language e.g. gherkin, Postman, or 
                                            # FHIR TestScript 
}  

# Test assertions or expectations
<TestPlan.testCase.assertion> EXTENDS @<BackboneElement> CLOSED {   
    fhir:type @<OneOrMore_CodeableConcept>?;  # Assertion type - for example 
                                            # 'informative' or 'required' 
    fhir:object @<OneOrMore_CodeableReference>?;  # The focus or object of the 
                                            # assertion 
    fhir:result @<OneOrMore_CodeableReference>?;  # The actual result assertion
}  

#---------------------- Cardinality Types (OneOrMore) -------------------

<OneOrMore_Identifier> CLOSED {
    rdf:first @<Identifier>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Identifier> 
}

<OneOrMore_ContactDetail> CLOSED {
    rdf:first @<ContactDetail>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ContactDetail> 
}

<OneOrMore_UsageContext> CLOSED {
    rdf:first @<UsageContext>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_UsageContext> 
}

<OneOrMore_CodeableConcept> CLOSED {
    rdf:first @<CodeableConcept>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_CodeableConcept> 
}

<OneOrMore_Reference> CLOSED {
    rdf:first @<Reference>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference> 
}

<OneOrMore_TestPlan.dependency> CLOSED {
    rdf:first @<TestPlan.dependency>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_TestPlan.dependency> 
}

<OneOrMore_TestPlan.testCase> CLOSED {
    rdf:first @<TestPlan.testCase>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_TestPlan.testCase> 
}

<OneOrMore_TestPlan.testCase.dependency> CLOSED {
    rdf:first @<TestPlan.testCase.dependency>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_TestPlan.testCase.dependency> 
}

<OneOrMore_TestPlan.testCase.testRun> CLOSED {
    rdf:first @<TestPlan.testCase.testRun>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_TestPlan.testCase.testRun> 
}

<OneOrMore_TestPlan.testCase.testData> CLOSED {
    rdf:first @<TestPlan.testCase.testData>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_TestPlan.testCase.testData> 
}

<OneOrMore_TestPlan.testCase.assertion> CLOSED {
    rdf:first @<TestPlan.testCase.assertion>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_TestPlan.testCase.assertion> 
}

<OneOrMore_CodeableReference> CLOSED {
    rdf:first @<CodeableReference>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_CodeableReference> 
}

#---------------------- Value Sets ------------------------

# The lifecycle status of an artifact.
fhirvs:publication-status ["draft" "active" "retired" "unknown"]


Usage note: every effort has been made to ensure that the ShEx files are correct and useful, but they are not a normative part of the specification.