-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: CDR-1550 add Robot tests for AQL Folder
- Loading branch information
1 parent
ac3fe16
commit 86de794
Showing
22 changed files
with
373 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
tests/robot/AQL_TESTS/FOLDER/FROM_FOLDER_CONTAINS_COMPO/select_all.robot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
*** Settings *** | ||
Documentation CHECK FOLDER CONTAINS COMPOSITION - Select All | ||
... - Covers: https://github.com/ehrbase/conformance-testing-documentation/blob/main/FOLDER.md#select-all | ||
... - *Precondition:* | ||
... - 1. Upload OPT; 2. Create EHR; | ||
... 3. Create 4 compositions with conformance_ehrbase.de.v0_max.json and store their compo_ids; | ||
... - 4. Create Directory with folder_with_compositions.json; | ||
... - Send AQL query and compare response body with expected file content. | ||
... - *Postcondition:* Delete EHR using ADMIN endpoint. | ||
Resource ../../../_resources/keywords/aql_keywords.robot | ||
|
||
Suite Setup Precondition | ||
Suite Teardown Admin Delete EHR For AQL | ||
|
||
|
||
*** Test Cases *** | ||
Folder Contains Composition: SELECT c/uid/value, f/name/value FROM FOLDER f CONTAINS COMPOSITION c | ||
[Tags] not-ready | ||
${query} Set Variable | ||
... SELECT c/uid/value, f/name/value FROM FOLDER f CONTAINS COMPOSITION c | ||
${temporary_file} Set Variable ${EXPECTED_JSON_DATA_SETS}/folder/expected_folder_contains_compo_select_all_tmp.json | ||
Set AQL And Execute Ad Hoc Query ${query} | ||
Length Should Be ${resp_body['rows']} 12 | ||
${expected_file} Set Variable expected_folder_contains_compo_select_all.json | ||
${expected_res_tmp} Set Variable ${EXPECTED_JSON_DATA_SETS}/folder/${expected_file} | ||
${file_without_replaced_vars} Get File ${expected_res_tmp} | ||
${data_replaced_vars} Replace Variables ${file_without_replaced_vars} | ||
Create File ${temporary_file} | ||
... ${data_replaced_vars} | ||
${exclude_paths} Create List root['meta'] root['q'] | ||
${diff} compare json-string with json-file | ||
... ${resp_body_actual} ${temporary_file} exclude_paths=${exclude_paths} | ||
... ignore_order=${TRUE} | ||
... ignore_string_case=${TRUE} | ||
Should Be Empty ${diff} msg=DIFF DETECTED! | ||
[Teardown] Remove File ${temporary_file} | ||
|
||
|
||
*** Keywords *** | ||
Precondition | ||
Set Library Search Order For Tests | ||
Upload OPT For AQL conformance_ehrbase.de.v0.opt | ||
Create EHR For AQL | ||
Commit Composition For AQL conformance_ehrbase.de.v0_max.json | ||
Set Suite Variable ${c_uid1} ${composition_short_uid} | ||
Commit Composition For AQL conformance_ehrbase.de.v0_max.json | ||
Set Suite Variable ${c_uid2} ${composition_short_uid} | ||
Commit Composition For AQL conformance_ehrbase.de.v0_max.json | ||
Set Suite Variable ${c_uid3} ${composition_short_uid} | ||
Commit Composition For AQL conformance_ehrbase.de.v0_max.json | ||
Set Suite Variable ${c_uid4} ${composition_short_uid} | ||
Create Directory For AQL folder_with_compositions.json has_robot_vars=${TRUE} |
33 changes: 32 additions & 1 deletion
33
tests/robot/AQL_TESTS/FOLDER/FROM_FOLDER_CONTAINS_FOLDER/find_all.robot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,32 @@ | ||
##TODO: Implementation to be continued from https://github.com/ehrbase/conformance-testing-documentation/blob/cc2de61cd54975d1cf40be066afd88616e294aa1/FOLDER.md#folder-contains-folder | ||
*** Settings *** | ||
Documentation CHECK FOLDER CONTAINS FOLDER - Find All | ||
... - Covers: https://github.com/ehrbase/conformance-testing-documentation/blob/main/FOLDER.md#find-all-1 | ||
... - *Precondition:* 1. Create EHR; 2. Create Directory with folder_complex_hierarchy.json; | ||
... - Send AQL query and compare response body with expected file content. | ||
... - *Postcondition:* Delete EHR using ADMIN endpoint. | ||
Resource ../../../_resources/keywords/aql_keywords.robot | ||
|
||
Suite Setup Precondition | ||
Suite Teardown Admin Delete EHR For AQL | ||
|
||
|
||
*** Test Cases *** | ||
Find All: SELECT f1/uid/value, f1/name/value, f2/uid/value, f2/name/value FROM FOLDER f1 CONTAINS FOLDER f2 | ||
[Tags] not-ready | ||
${query} Set Variable SELECT f1/uid/value, f1/name/value, f2/uid/value, f2/name/value FROM FOLDER f1 CONTAINS FOLDER f2 | ||
Set AQL And Execute Ad Hoc Query ${query} | ||
Length Should Be ${resp_body['rows']} 10 | ||
${expected_result} Set Variable ${EXPECTED_JSON_DATA_SETS}/folder/expected_folder_contains_folder_find_all.json | ||
${exclude_paths} Create List root['meta'] root['q'] | ||
${diff} compare json-string with json-file | ||
... ${resp_body_actual} ${expected_result} exclude_paths=${exclude_paths} | ||
... ignore_order=${TRUE} | ||
... ignore_string_case=${TRUE} | ||
Should Be Empty ${diff} msg=DIFF DETECTED! | ||
|
||
|
||
*** Keywords *** | ||
Precondition | ||
Set Library Search Order For Tests | ||
Create EHR For AQL | ||
Create Directory For AQL folder_complex_hierarchy.json |
41 changes: 41 additions & 0 deletions
41
tests/robot/AQL_TESTS/FOLDER/FROM_FOLDER_CONTAINS_FOLDER/find_by.robot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
*** Settings *** | ||
Documentation CHECK FOLDER CONTAINS FOLDER - Find By | ||
... - Covers: https://github.com/ehrbase/conformance-testing-documentation/blob/main/FOLDER.md#find-by | ||
... - *Precondition:* 1. Create EHR; 2. Create Directory with folder_complex_hierarchy.json; | ||
... - Send AQL query and compare response body with expected file content. | ||
... - *Postcondition:* Delete EHR using ADMIN endpoint. | ||
Resource ../../../_resources/keywords/aql_keywords.robot | ||
Library DataDriver | ||
... file=${PROJECT_ROOT}/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/combinations/folder_contains_folder_find_by.csv | ||
... dialect=excel | ||
|
||
Suite Setup Precondition | ||
Suite Teardown Admin Delete EHR For AQL ${ehr_id} | ||
|
||
|
||
*** Test Cases *** | ||
${query_nr} SELECT f2/uid/value, f2/name/value FROM FOLDER f1[${predicate1}] CONTAINS FOLDER f2[${predicate2}] | ||
[Tags] not-ready | ||
[Template] Execute Query | ||
${predicate1} ${predicate2} ${expected_file} ${nr_of_results} | ||
|
||
|
||
*** Keywords *** | ||
Precondition | ||
Set Library Search Order For Tests | ||
Create EHR For AQL | ||
Create Directory For AQL folder_complex_hierarchy.json | ||
|
||
Execute Query | ||
[Arguments] ${predicate1} ${predicate2} ${expected_file} ${nr_of_results} | ||
${query} Set Variable SELECT f2/uid/value, f2/name/value FROM FOLDER f1[${predicate1}] CONTAINS FOLDER f2[${predicate2}] | ||
Set AQL And Execute Ad Hoc Query ${query} | ||
Log ${expected_file} | ||
${expected_result} Set Variable ${EXPECTED_JSON_DATA_SETS}/folder/${expected_file} | ||
Length Should Be ${resp_body['rows']} ${nr_of_results} | ||
${exclude_paths} Create List root['meta'] | ||
${diff} compare json-string with json-file | ||
... ${resp_body_actual} ${expected_result} | ||
... exclude_paths=${exclude_paths} | ||
... ignore_order=${TRUE} ignore_string_case=${TRUE} | ||
Should Be Empty ${diff} msg=DIFF DETECTED! |
47 changes: 47 additions & 0 deletions
47
tests/robot/AQL_TESTS/FOLDER/MULTIPLE_EHRS/folder_multiple_ehrs.robot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
*** Settings *** | ||
Documentation CHECK FOLDER MULTIPLE EHRS | ||
... - Covers: https://github.com/ehrbase/conformance-testing-documentation/blob/main/FOLDER.md#multiple-ehrs | ||
... - *Precondition:* | ||
... - 1. Create EHR; 2. Create Directory with folder_complex_hierarchy.json; | ||
... - 3. Create Directory with folder_complex_hierarchy2.json; | ||
... - Send AQL query and compare response body with expected file content. | ||
... - *Postcondition:* Delete EHR using ADMIN endpoint. | ||
Resource ../../../_resources/keywords/aql_keywords.robot | ||
|
||
Suite Setup Precondition | ||
Suite Teardown Run Keywords Admin Delete EHR For AQL ${ehr_id1} AND | ||
... Admin Delete EHR For AQL ${ehr_id2} | ||
|
||
|
||
*** Test Cases *** | ||
Multiple EHRs: SELECT e/ehr_id/value, f/uid/value FROM EHR e CONTAINS FOLDER f[openEHR-EHR-FOLDER.episode_of_care.v1,'subsubfolder1'] | ||
${query} Set Variable | ||
... SELECT e/ehr_id/value, f/uid/value FROM EHR e CONTAINS FOLDER f[openEHR-EHR-FOLDER.episode_of_care.v1,'subsubfolder1'] | ||
${temporary_file} Set Variable ${EXPECTED_JSON_DATA_SETS}/folder/expected_folder_multiple_ehrs_tmp.json | ||
Set AQL And Execute Ad Hoc Query ${query} | ||
Length Should Be ${resp_body['rows']} 4 | ||
${expected_file} Set Variable expected_folder_multiple_ehrs.json | ||
${temporary_file} Set Variable ${EXPECTED_JSON_DATA_SETS}/folder/expected_folder_multiple_ehrs_tmp.json | ||
${expected_res_tmp} Set Variable ${EXPECTED_JSON_DATA_SETS}/folder/${expected_file} | ||
${file_without_replaced_vars} Get File ${expected_res_tmp} | ||
${data_replaced_vars} Replace Variables ${file_without_replaced_vars} | ||
Create File ${temporary_file} | ||
... ${data_replaced_vars} | ||
${exclude_paths} Create List root['meta'] root['q'] | ||
${diff} compare json-string with json-file | ||
... ${resp_body_actual} ${temporary_file} exclude_paths=${exclude_paths} | ||
... ignore_order=${TRUE} | ||
... ignore_string_case=${TRUE} | ||
Should Be Empty ${diff} msg=DIFF DETECTED! | ||
[Teardown] Remove File ${temporary_file} | ||
|
||
|
||
*** Keywords *** | ||
Precondition | ||
Set Library Search Order For Tests | ||
Create EHR For AQL | ||
Set Suite Variable ${ehr_id1} ${ehr_id} | ||
Create Directory For AQL folder_complex_hierarchy.json | ||
Create EHR For AQL | ||
Set Suite Variable ${ehr_id2} ${ehr_id} | ||
Create Directory For AQL folder_complex_hierarchy2.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.