R6 Ballot (2nd Draft)

Publish-box (todo)

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 <id.shex>
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 <Resource.shex>
IMPORT <canonical.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_Resource>?;  # 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 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
}  

# Required criteria to execute the test case
<TestPlan.testCase.dependency> EXTENDS @<BackboneElement> CLOSED {   
    fhir:description @<markdown>?;          # Description of the criteria
    fhir:reference @<canonical>?;           # Canonical reference to the 
                                            # TestPlan dependency instance 
    fhir:key @<id>?;                        # TestPlan dependency instance 
                                            # testCase key identifier 
}  

# 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> AND {fhir:link 
    			@<Resource> ? }?;  # The actual test resources when 
                                            # they exist 
    fhir:source @<string>  OR 
    			(@<Reference>  AND {fhir:link @<Resource> })  ?;  # Pointer to a definition of test 
                                            # resources - narrative or 
                                            # structured e.g. synthetic data 
                                            # generation, etc 
}  

# Links or references to the testing requirements
<TestPlan.testCase.requirement> EXTENDS @<BackboneElement> CLOSED {   
    fhir:reference @<canonical>;            # Canonical reference to the 
                                            # Requirements instance 
    fhir:key @<id>;                         # Requirements statement key 
                                            # identifier 
}  

# The test cases that constitute this plan
<TestPlan.testCase> EXTENDS @<BackboneElement> CLOSED {   
    fhir:key @<id>;                         # Key that identifies this test case
    fhir:description @<markdown>?;          # Narrative description explaining 
                                            # the purpose of this test case 
    fhir:sequence @<integer>?;              # Sequence of test case in the test 
                                            # plan 
    fhir:scope @<OneOrMore_Reference_Resource>?;  # The scope or artifact covered by 
                                            # the case 
    fhir:requirement @<OneOrMore_TestPlan.testCase.requirement>?;  # Links or references to the testing 
                                            # requirements 
    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 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>  AND {fhir:link @<Resource> })  ?;  # The actual content of the cases - 
                                            # references to TestScripts or 
                                            # externally defined content 
}  

# 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> AND {fhir:link 
    			@<TestPlan> ? }?;  # Link to predecessor test plans
}  

#---------------------- 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_Resource> CLOSED {
    rdf:first @<Reference> AND {fhir:link 
			@<Resource> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_Resource> 
}

<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_CodeableReference> CLOSED {
    rdf:first @<CodeableReference>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_CodeableReference> 
}

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

<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> 
}

#---------------------- 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.