Serenity BDD Report
Home > Requirements > Stufe5 > Dokumentenaustausch > Upload of a documentreference with POST operation (dokumentenbereitstellung) (@documentreference-post)
Report generated 01-09-2026 07:04

Feature: Upload of a documentreference with POST operation (dokumentenbereitstellung) (@documentreference-post)

Scenarios

Given the Test Description: "The system under test MUST be able to resolve the Patient and Encounter referenced in the DocumentReference. The embedded document MUST be extracted, persisted separately, and made available via the Binary endpoint of the API."

Given the Preconditions: This set of tests assumes that the system under test supports the create interaction for the DocumentReference resource.
The test dataset must be entered in the system under test according to the specifications (manually).

The following values from the configuration file must be used in the resource to be created:

  • The masterIdentifier value to be used (variable name: 'documentreference-post-master-identifier-value')
  • The reference to a valid Encounter resource ID (variable name: 'documentreference-read-encounter-id')
  • The reference to a valid Patient resource ID to be used (variable name: 'documentreference-read-patient-id')

When Get FHIR resource at "http://fhirserver/metadata" with content type "json"

And CapabilityStatement contains interaction "create" for resource "DocumentReference"

Given TGR set default header "Content-Type" to "application/fhir+json"

When TGR send POST request to "http://fhirserver/DocumentReference" with body "!{file('src/test/resources/features/Stufe5/Dokumentenaustausch/fixtures/DocumentReference-Post-Correct.json')}"

And TGR find the last request

Then TGR current response with attribute "$.responseCode" matches "20\d"

And FHIR current response body is a valid isik5 resource and conforms to profile "https://gematik.de/fhir/isik/StructureDefinition/ISiKDokumentenMetadaten"

And FHIR current response body evaluates the FHIRPath "masterIdentifier.where(system = 'urn:ietf:rfc:3986' and value = '${data.documentreference-post-master-identifier-value}').exists()" with error message 'The version-specific OID of the document does not match the expected value'

And FHIR current response body evaluates the FHIRPath "identifier.where(system = 'urn:uuid:96fdda7c-d067-4183-912e-bf5ee74998a8' and value = '129.6.58.42.11111').exists()" with error message 'The identifier does not match the expected value'

And TGR current response with attribute "$.body.status.content" matches "current"

And TGR current response with attribute "$.body.docStatus.content" matches "final"

And FHIR current response body evaluates the FHIRPath "content.attachment.title = 'Molekularpathologiebefund vom 12.02.26'" with error message 'The document title does not match the expected value'

And FHIR current response body evaluates the FHIRPath "type.coding.where(system = 'http://dvmd.de/fhir/CodeSystem/kdl' and code = 'PT130102' and display = 'Molekularpathologiebefund').exists()" with error message 'The document type (KDL) code does not match the expected value'

And FHIR current response body evaluates the FHIRPath "type.coding.where(system = 'http://ihe-d.de/CodeSystems/IHEXDStypeCode' and code = 'PATH' and display = 'Pathologiebefundberichte').exists()" with error message 'The document type (XDS) code does not match the expected value'

And element "subject" references resource with ID "${data.documentreference-read-patient-id}" with error message "The patient reference does not match the expected value"

And element "context.encounter" references resource with ID "${data.documentreference-read-encounter-id}" with error message "The patient reference does not match the expected value"

And FHIR current response body evaluates the FHIRPath "author.display.contains('Harold Hippocrates')" with error message 'The document author does not match the expected value'

And FHIR current response body evaluates the FHIRPath "securityLabel.coding.where(code = 'N' and system = 'http://terminology.hl7.org/CodeSystem/v3-Confidentiality').exists()" with error message 'The confidentiality does not match the expected value'

And FHIR current response body evaluates the FHIRPath "content.where(attachment.where(contentType = 'application/pdf' and (language = 'de' or language.startsWith('de-')) and url.exists() and data.exists().not() and creation = @2026-02-12T12:50:50+01:00).exists() and format.where(code = 'urn:ihe:iti:xds:2017:mimeTypeSufficient' and system = 'http://ihe.net/fhir/ihe.formatcode.fhir/CodeSystem/formatcode').exists()).exists()" with error message 'The attachment does not match the expected value'

And FHIR current response body evaluates the FHIRPath "context.where(facilityType.coding.where(code = 'KHS' and system = 'http://ihe-d.de/CodeSystems/PatientBezogenenGesundheitsversorgung').exists() and practiceSetting.where(coding.where(code = 'ALLG' and system = 'http://ihe-d.de/CodeSystems/AerztlicheFachrichtungen').exists()).exists()).exists()" with error message 'The context does not match the expected value'

And FHIR current response body evaluates the FHIRPath "category.coding.where(code = 'BEF' and system = 'http://ihe-d.de/CodeSystems/IHEXDSclassCode' and display = 'Befundbericht').exists()" with error message 'The document class does not match the expected value'

Given TGR set default header "Content-Type" to "application/fhir+json"

When TGR send POST request to "http://fhirserver/DocumentReference" with body "!{file('src/test/resources/features/Stufe5/Dokumentenaustausch/fixtures/{inputFile}')}"

And TGR find the last request

Then TGR current response with attribute "$.responseCode" matches "{responseCode}"

And FHIR current response body evaluates the FHIRPath "issue.where(severity = 'error' or 'fatal').count() }= 1" with error message 'The OperationOutcome does not contain the required issue(s)'

Examples:

inputFileresponseCode
DocumentReference-Post-UnknownPatient.json422
DocumentReference-Post-UnknownEncounter.json422
DocumentReference-Post-MissingAttachmentData.json4\d\d

Feature Coverage By Scenario

Test Outcomes

Test Performance

Key Statistics

Number of Scenarios 4 Total Duration 16s
Total Number of Test Cases 6 Fastest Test 487ms
Number of Manual Test Cases 0 Slowest Test 9s
Tests Started Sep 01, 2026 07:04:47 Average Execution Time 2s
Tests Finished Sep 01, 2026 07:05:03 Cumulative Test Time
(sum of all individual test durations)
16s

Automated Tests

feature Scenario Context Steps Started Total Duration Result
Upload of a DocumentReference with POST Operation (Dokumentenbereitstellung) (@DocumentReference-Post) Precondition 2 07:04:47 487ms SUCCESS
Upload of a DocumentReference with POST Operation (Dokumentenbereitstellung) (@DocumentReference-Post) Read and Validation of the CapabilityStatement 2 07:04:47 2s 835ms SUCCESS
Upload of a DocumentReference with POST Operation (Dokumentenbereitstellung) (@DocumentReference-Post) POST a DocumentBundle with known patient and encounter 19 07:04:50 9s 660ms SUCCESS
Upload of a DocumentReference with POST Operation (Dokumentenbereitstellung) (@DocumentReference-Post) POST an incorrect DocumentBundle
3 passing test cases
5 07:05:00 3s 684ms SUCCESS

Manual Tests

No manual tests were recorded

Evidence

Scenario Title Details
Precondition RBellog 0  Download Evidence
Read and Validation of the CapabilityStatement INFO - rest.where(mode = 'server').resource.where(type = 'DocumentReference' and interaction.where(code = 'create').exists()).exists()  Details
Read and Validation of the CapabilityStatement RBellog 0  Download Evidence
Read and Validation of the CapabilityStatement Evidence Report  Download Evidence
POST a DocumentBundle with known patient and encounter INFO - Code system definition is missing for 'http://dvmd.de/fhir/CodeSystem/kdl#PT130102'  Details
POST a DocumentBundle with known patient and encounter WARN - Value set http://dvmd.de/fhir/ValueSet/kdl has been ignored due to module configuration  Details
POST a DocumentBundle with known patient and encounter INFO - masterIdentifier.where(system = 'urn:ietf:rfc:3986' and value = 'urn:oid:1.2.840.113556.1.8000.2554.58783.21864.3474.19410.44358.58254.41281.11111').exists()  Details
POST a DocumentBundle with known patient and encounter INFO - identifier.where(system = 'urn:uuid:96fdda7c-d067-4183-912e-bf5ee74998a8' and value = '129.6.58.42.11111').exists()  Details
POST a DocumentBundle with known patient and encounter INFO - content.attachment.title = 'Molekularpathologiebefund vom 12.02.26'  Details
POST a DocumentBundle with known patient and encounter INFO - type.coding.where(system = 'http://dvmd.de/fhir/CodeSystem/kdl' and code = 'PT130102' and display = 'Molekularpathologiebefund').exists()  Details
POST a DocumentBundle with known patient and encounter INFO - type.coding.where(system = 'http://ihe-d.de/CodeSystems/IHEXDStypeCode' and code = 'PATH' and display = 'Pathologiebefundberichte').exists()  Details
POST a DocumentBundle with known patient and encounter INFO - subject.reference.replaceMatches('/_history/.+','').matches('\\bPatient-Read-Example$')  Details
POST a DocumentBundle with known patient and encounter INFO - context.encounter.reference.replaceMatches('/_history/.+','').matches('\\bEncounter-Read-Finished-Example$')  Details
POST a DocumentBundle with known patient and encounter INFO - author.display.contains('Harold Hippocrates')  Details
POST a DocumentBundle with known patient and encounter INFO - securityLabel.coding.where(code = 'N' and system = 'http://terminology.hl7.org/CodeSystem/v3-Confidentiality').exists()  Details
POST a DocumentBundle with known patient and encounter INFO - content.where(attachment.where(contentType = 'application/pdf' and (language = 'de' or language.startsWith('de-')) and url.exists() and data.exists().not() and creation = @2026-02-12T12:50:50+01:00).exists() and format.where(code = 'urn:ihe:iti:xds:2017:mimeTypeSufficient' and system = 'http://ihe.net/fhir/ihe.formatcode.fhir/CodeSystem/formatcode').exists()).exists()  Details
POST a DocumentBundle with known patient and encounter INFO - context.where(facilityType.coding.where(code = 'KHS' and system = 'http://ihe-d.de/CodeSystems/PatientBezogenenGesundheitsversorgung').exists() and practiceSetting.where(coding.where(code = 'ALLG' and system = 'http://ihe-d.de/CodeSystems/AerztlicheFachrichtungen').exists()).exists()).exists()  Details
POST a DocumentBundle with known patient and encounter INFO - category.coding.where(code = 'BEF' and system = 'http://ihe-d.de/CodeSystems/IHEXDSclassCode' and display = 'Befundbericht').exists()  Details
POST a DocumentBundle with known patient and encounter RBellog 0  Download Evidence
POST a DocumentBundle with known patient and encounter Evidence Report  Download Evidence
POST an incorrect DocumentBundle INFO - issue.where(severity = 'error' or 'fatal').count() >= 1  Details
POST an incorrect DocumentBundle RBellog 1  Download Evidence
POST an incorrect DocumentBundle Evidence Report  Download Evidence
POST an incorrect DocumentBundle INFO - issue.where(severity = 'error' or 'fatal').count() >= 1  Details
POST an incorrect DocumentBundle RBellog 2  Download Evidence
POST an incorrect DocumentBundle Evidence Report  Download Evidence
POST an incorrect DocumentBundle INFO - issue.where(severity = 'error' or 'fatal').count() >= 1  Details
POST an incorrect DocumentBundle RBellog 3  Download Evidence
POST an incorrect DocumentBundle Evidence Report  Download Evidence
Serenity BDD version 5.3.10