Skip to content

Commit 5f0f20e

Browse files
Merge pull request #710 from NHSDigital/feature/hakh11-NRL-1002-consumerIntegrationTests
Feature/hakh11 nrl 1002 consumer integration tests
2 parents 98dd85d + 2393799 commit 5f0f20e

File tree

4 files changed

+255
-71
lines changed

4 files changed

+255
-71
lines changed

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ test-features-integration: check-warn ## Run the BDD feature tests in the integr
8686
--define="use_shared_resources=${USE_SHARED_RESOURCES}" \
8787
$(FEATURE_TEST_ARGS)
8888

89+
integration-test-with-custom_tag:
90+
@echo "Running feature tests in the integration environment ${TF_WORKSPACE_NAME}"
91+
behave --define="integration_test=true" --tags=@custom_tag \
92+
--define="env=$(TF_WORKSPACE_NAME)" \
93+
--define="account_name=$(ENV)" \
94+
--define="use_shared_resources=${USE_SHARED_RESOURCES}" \
95+
$(FEATURE_TEST_ARGS)
96+
8997
test-features-integration-report: check-warn ## Run the BDD feature tests in the integration environment and generate allure report therafter
9098
@echo "Cleaning previous Allure results and reports"
9199
rm -rf ./allure-results

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,27 @@ To run the Firehose integration tests:
277277
$ make test-firehose-integration
278278
```
279279

280-
To run the feature integration tests:
280+
To run all the feature integration tests:
281281

282282
```
283283
$ make test-features-integration
284284
```
285285

286+
To run indivudal feature test scenario(s) using the custom tag :
287+
288+
1. Add "@custom_tag" before each 'Scenario' that needs to be run (in each .feature file)
289+
2. Run the command below:
290+
291+
```
292+
$ make integration-test-with-custom_tag
293+
```
294+
295+
To run all the feature integration tests and generate an interactive Allure report therafter :
296+
297+
```
298+
$ make test-features-integration-report
299+
```
300+
286301
### Smoke testing
287302

288303
For smoke tests, you need to have deployed your infrastructure (using Terraform).

tests/features/consumer/searchDocumentReference-success.feature

Lines changed: 154 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -36,75 +36,138 @@ Feature: Consumer - searchDocumentReference - Success Scenarios
3636
| custodian | 02V |
3737
| author | 02V |
3838

39-
Scenario: Search for multiple DocumentReferences by NHS number
39+
Scenario: Search for a DocumentReference by NHS Number and Custodian where both search parameters match
4040
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
4141
And the organisation 'RX898' is authorised to access pointer types:
4242
| system | value |
4343
| http://snomed.info/sct | 736253002 |
4444
And a DocumentReference resource exists with values:
45-
| property | value |
46-
| id | 02V-1111111111-SearchMultipleRefTest1 |
47-
| subject | 9278693472 |
48-
| status | current |
49-
| type | 736253002 |
50-
| category | 734163000 |
51-
| contentType | application/pdf |
52-
| url | https://example.org/my-doc-1.pdf |
53-
| custodian | 02V |
54-
| author | 02V |
45+
| property | value |
46+
| id | 02V-1111111111-SearchDocRefTest |
47+
| subject | 9278693472 |
48+
| status | current |
49+
| type | 736253002 |
50+
| category | 734163000 |
51+
| contentType | application/pdf |
52+
| url | https://example.org/my-doc.pdf |
53+
| custodian | 02V |
54+
| author | 02V |
55+
When consumer 'RX898' searches for DocumentReferences with parameters:
56+
| parameter | value |
57+
| subject | 9278693472 |
58+
| custodian | 02V |
59+
Then the response status code is 200
60+
And the response is a searchset Bundle
61+
And the Bundle has a self link matching 'DocumentReference?subject:identifier=https://fhir.nhs.uk/Id/nhs-number|9278693472&custodian:identifier=https://fhir.nhs.uk/Id/ods-organization-code|02V'
62+
And the Bundle has a total of 1
63+
And the Bundle has 1 entry
64+
And the Bundle contains an DocumentReference with values
65+
| property | value |
66+
| id | 02V-1111111111-SearchDocRefTest |
67+
| subject | 9278693472 |
68+
| status | current |
69+
| type | 736253002 |
70+
| category | 734163000 |
71+
| contentType | application/pdf |
72+
| url | https://example.org/my-doc.pdf |
73+
| custodian | 02V |
74+
| author | 02V |
75+
76+
Scenario: Search for a DocumentReference by NHS Number and Custodian where Custodian filter matches one pointer from result set
77+
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
78+
And the organisation 'RX898' is authorised to access pointer types:
79+
| system | value |
80+
| http://snomed.info/sct | 736253002 |
5581
And a DocumentReference resource exists with values:
56-
| property | value |
57-
| id | 02V-1111111111-SearchMultipleRefTest2 |
58-
| subject | 9278693472 |
59-
| status | current |
60-
| type | 736253002 |
61-
| category | 734163000 |
62-
| contentType | application/pdf |
63-
| url | https://example.org/my-doc-2.pdf |
64-
| custodian | 02V |
65-
| author | 02V |
82+
| property | value |
83+
| id | 02V-1111111111-SearchDocRefTest |
84+
| subject | 9278693472 |
85+
| status | current |
86+
| type | 736253002 |
87+
| category | 734163000 |
88+
| contentType | application/pdf |
89+
| url | https://example.org/my-doc.pdf |
90+
| custodian | 02V |
91+
| author | 02V |
6692
And a DocumentReference resource exists with values:
67-
| property | value |
68-
| id | 02V-1111111111-SearchMultipleRefTest3 |
69-
| subject | 9278693472 |
70-
| status | current |
71-
| type | 887701000000100 |
72-
| category | 734163000 |
73-
| contentType | application/pdf |
74-
| url | https://example.org/my-doc-3.pdf |
75-
| custodian | 02V |
76-
| author | 02V |
93+
| property | value |
94+
| id | DK94-1111111112-SearchDocRefTest |
95+
| subject | 9278693472 |
96+
| status | current |
97+
| type | 736253002 |
98+
| category | 734163000 |
99+
| contentType | application/pdf |
100+
| url | https://example.org/my-doc.pdf |
101+
| custodian | DK94 |
102+
| author | DK94 |
77103
When consumer 'RX898' searches for DocumentReferences with parameters:
78104
| parameter | value |
79105
| subject | 9278693472 |
106+
| custodian | 02V |
80107
Then the response status code is 200
81108
And the response is a searchset Bundle
82-
And the Bundle has a self link matching 'DocumentReference?subject:identifier=https://fhir.nhs.uk/Id/nhs-number|9278693472'
83-
And the Bundle has a total of 2
84-
And the Bundle has 2 entries
109+
And the Bundle has a self link matching 'DocumentReference?subject:identifier=https://fhir.nhs.uk/Id/nhs-number|9278693472&custodian:identifier=https://fhir.nhs.uk/Id/ods-organization-code|02V'
110+
And the Bundle has a total of 1
111+
And the Bundle has 1 entry
85112
And the Bundle contains an DocumentReference with values
86-
| property | value |
87-
| id | 02V-1111111111-SearchMultipleRefTest1 |
88-
| subject | 9278693472 |
89-
| status | current |
90-
| type | 736253002 |
91-
| category | 734163000 |
92-
| contentType | application/pdf |
93-
| url | https://example.org/my-doc-1.pdf |
94-
| custodian | 02V |
95-
| author | 02V |
113+
| property | value |
114+
| id | 02V-1111111111-SearchDocRefTest |
115+
| subject | 9278693472 |
116+
| status | current |
117+
| type | 736253002 |
118+
| category | 734163000 |
119+
| contentType | application/pdf |
120+
| url | https://example.org/my-doc.pdf |
121+
| custodian | 02V |
122+
| author | 02V |
123+
124+
Scenario: Search for a DocumentReference by NHS Number and Custodian where NHS number filter matches one pointer from result set
125+
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
126+
And the organisation 'RX898' is authorised to access pointer types:
127+
| system | value |
128+
| http://snomed.info/sct | 736253002 |
129+
And a DocumentReference resource exists with values:
130+
| property | value |
131+
| id | 02V-1111111111-SearchDocRefTest |
132+
| subject | 9278693472 |
133+
| status | current |
134+
| type | 736253002 |
135+
| category | 734163000 |
136+
| contentType | application/pdf |
137+
| url | https://example.org/my-doc.pdf |
138+
| custodian | 02V |
139+
| author | 02V |
140+
And a DocumentReference resource exists with values:
141+
| property | value |
142+
| id | 02V-1111111112-SearchDocRefTest |
143+
| subject | 9785146901 |
144+
| status | current |
145+
| type | 736253002 |
146+
| category | 734163000 |
147+
| contentType | application/pdf |
148+
| url | https://example.org/my-doc.pdf |
149+
| custodian | 02V |
150+
| author | 02V |
151+
When consumer 'RX898' searches for DocumentReferences with parameters:
152+
| parameter | value |
153+
| subject | 9278693472 |
154+
| custodian | 02V |
155+
Then the response status code is 200
156+
And the response is a searchset Bundle
157+
And the Bundle has a self link matching 'DocumentReference?subject:identifier=https://fhir.nhs.uk/Id/nhs-number|9278693472&custodian:identifier=https://fhir.nhs.uk/Id/ods-organization-code|02V'
158+
And the Bundle has a total of 1
159+
And the Bundle has 1 entry
96160
And the Bundle contains an DocumentReference with values
97-
| property | value |
98-
| id | 02V-1111111111-SearchMultipleRefTest2 |
99-
| subject | 9278693472 |
100-
| status | current |
101-
| type | 736253002 |
102-
| category | 734163000 |
103-
| contentType | application/pdf |
104-
| url | https://example.org/my-doc-2.pdf |
105-
| custodian | 02V |
106-
| author | 02V |
107-
And the Bundle does not contain a DocumentReference with ID '02V-1111111111-SearchMultipleRefTest3'
161+
| property | value |
162+
| id | 02V-1111111111-SearchDocRefTest |
163+
| subject | 9278693472 |
164+
| status | current |
165+
| type | 736253002 |
166+
| category | 734163000 |
167+
| contentType | application/pdf |
168+
| url | https://example.org/my-doc.pdf |
169+
| custodian | 02V |
170+
| author | 02V |
108171

109172
Scenario: Search for multiple DocumentReferences by NHS number
110173
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
@@ -149,6 +212,7 @@ Feature: Consumer - searchDocumentReference - Success Scenarios
149212
| subject | 9278693472 |
150213
Then the response status code is 200
151214
And the response is a searchset Bundle
215+
And the Bundle has a self link matching 'DocumentReference?subject:identifier=https://fhir.nhs.uk/Id/nhs-number|9278693472'
152216
And the Bundle has a total of 2
153217
And the Bundle has 2 entries
154218
And the Bundle contains an DocumentReference with values
@@ -175,6 +239,38 @@ Feature: Consumer - searchDocumentReference - Success Scenarios
175239
| author | 02V |
176240
And the Bundle does not contain a DocumentReference with ID '02V-1111111111-SearchMultipleRefTest3'
177241

178-
# No pointers found
179-
# Pointers exist but no permissions
180-
# Search by custodian
242+
Scenario: Search for a DocumentReference by NHS Number where 0 pointers are found
243+
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
244+
And the organisation 'DK94' is authorised to access pointer types:
245+
| system | value |
246+
| http://snomed.info/sct | 736253002 |
247+
| http://snomed.info/sct | 861421000000109 |
248+
And the organisation 'RX898' is authorised to access pointer types:
249+
| system | value |
250+
| http://snomed.info/sct | 736253002 |
251+
| http://snomed.info/sct | 861421000000109 |
252+
And a DocumentReference resource exists with values:
253+
| property | value |
254+
| id | DK94-111-DeleteDocRefTest1 |
255+
| subject | 9278693472 |
256+
| status | current |
257+
| type | 861421000000109 |
258+
| category | 734163000 |
259+
| contentType | application/pdf |
260+
| url | https://example.org/my-doc.pdf |
261+
| custodian | DK94 |
262+
| author | N64 |
263+
When producer 'DK94' requests to delete DocumentReference with id 'DK94-111-DeleteDocRefTest1'
264+
And consumer 'RX898' searches for DocumentReferences with parameters:
265+
| parameter | value |
266+
| subject | 9278693472 |
267+
| custodian | RX898 |
268+
Then the response status code is 200
269+
And the response is a searchset Bundle
270+
And the Bundle has a self link matching 'DocumentReference?subject:identifier=https://fhir.nhs.uk/Id/nhs-number|9278693472&custodian:identifier=https://fhir.nhs.uk/Id/ods-organization-code|RX898'
271+
And the Bundle has a total of 0
272+
And the Bundle has 0 entry
273+
274+
# No pointers found - done
275+
# Pointers exist but no permissions - covered in failure scenarios
276+
# Search by custodian - done

0 commit comments

Comments
 (0)