diff --git a/tests/robot/AQL_TESTS/FOLDER/FROM_FOLDER/find_all_and_by.robot b/tests/robot/AQL_TESTS/FOLDER/FROM_FOLDER/find_all_and_by.robot index 3f995d8a..366203c4 100644 --- a/tests/robot/AQL_TESTS/FOLDER/FROM_FOLDER/find_all_and_by.robot +++ b/tests/robot/AQL_TESTS/FOLDER/FROM_FOLDER/find_all_and_by.robot @@ -10,10 +10,10 @@ Suite Teardown Admin Delete EHR For AQL #enable this keyword if AQL check *** Test Cases *** -Find All: SELECT f/uid/value, f/name/value, f/archetype_node_id, f/items/id/value FROM FOLDER f +Find All: SELECT f/uid/value, f/name/value, f/archetype_node_id FROM FOLDER f [Documentation] ... Covers: https://github.com/ehrbase/conformance-testing-documentation/blob/main/FOLDER.md#find-all - ${query} Set Variable SELECT f/uid/value, f/name/value, f/archetype_node_id, f/items/id/value FROM FOLDER f + ${query} Set Variable SELECT f/uid/value, f/name/value, f/archetype_node_id FROM FOLDER f Set AQL And Execute Ad Hoc Query ${query} Length Should Be ${resp_body['rows']} 3 ${expected_result} Set Variable ${EXPECTED_JSON_DATA_SETS}/folder/expected_find_all.json diff --git a/tests/robot/AQL_TESTS/FOLDER/FROM_FOLDER_CONTAINS_COMPO/over_multiple_ehrs.robot b/tests/robot/AQL_TESTS/FOLDER/FROM_FOLDER_CONTAINS_COMPO/over_multiple_ehrs.robot index 7341c989..e250eed8 100644 --- a/tests/robot/AQL_TESTS/FOLDER/FROM_FOLDER_CONTAINS_COMPO/over_multiple_ehrs.robot +++ b/tests/robot/AQL_TESTS/FOLDER/FROM_FOLDER_CONTAINS_COMPO/over_multiple_ehrs.robot @@ -38,6 +38,7 @@ Over Multiple EHRs: ${q} ${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} ${expected_result} exclude_paths=${exclude_paths} ... ignore_string_case=${TRUE} diff --git a/tests/robot/AQL_TESTS/FOLDER/FROM_FOLDER/find_by_specific_item_id.robot b/tests/robot/AQL_TESTS/FOLDER/SELECT_PATHS_IN_FOLDER/find_by_specific_item_id.robot similarity index 65% rename from tests/robot/AQL_TESTS/FOLDER/FROM_FOLDER/find_by_specific_item_id.robot rename to tests/robot/AQL_TESTS/FOLDER/SELECT_PATHS_IN_FOLDER/find_by_specific_item_id.robot index c62b0a81..41cc8753 100644 --- a/tests/robot/AQL_TESTS/FOLDER/FROM_FOLDER/find_by_specific_item_id.robot +++ b/tests/robot/AQL_TESTS/FOLDER/SELECT_PATHS_IN_FOLDER/find_by_specific_item_id.robot @@ -1,22 +1,21 @@ *** Settings *** -Documentation CHECK AQL RESPONSE ON FOLDER FROM +Documentation CHECK FOLDER FIND BY SPECIFIC ITEM ID - VERSIONED_COMPOSITION - HIER_OBJECT_ID +... - Covers: https://github.com/ehrbase/conformance-testing-documentation/blob/main/FOLDER.md#find-by-specific-item-id---versioned_composition---hier_object_id ... - *Precondition:* 1. Create EHR; 2. Create Directory with folder_details.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 #enable this keyword if AQL checks are passing !!! -Suite Teardown Admin Delete EHR For AQL #enable this keyword if AQL checks are passing !!! +Suite Setup Precondition +Suite Teardown Admin Delete EHR For AQL *** Test Cases *** -Find All: SELECT f/uid/value, f/name/value, f/items/id/value FROM FOLDER f WHERE f/items/id/value = '7c0a9df0-564f-4f34-8e65-92586c64ef56' - [Documentation] - ... Covers: https://github.com/ehrbase/conformance-testing-documentation/blob/main/FOLDER.md#find-by-specific-item-id---versioned_composition---hier_object_id +Find By Specific Item Id: SELECT f/uid/value, f/name/value, f/items/id/value FROM FOLDER f WHERE f/items/id/value = '7c0a9df0-564f-4f34-8e65-92586c64ef56' ${query} Set Variable SELECT f/uid/value, f/name/value, f/items/id/value FROM FOLDER f WHERE f/items/id/value = '7c0a9df0-564f-4f34-8e65-92586c64ef56' Set AQL And Execute Ad Hoc Query ${query} Length Should Be ${resp_body['rows']} 1 - ${expected_result} Set Variable ${EXPECTED_JSON_DATA_SETS}/folder/expected_find_by_item_id.json + ${expected_result} Set Variable ${EXPECTED_JSON_DATA_SETS}/folder/expected_folder_find_by_item_id.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} diff --git a/tests/robot/AQL_TESTS/FOLDER/SELECT_PATHS_IN_FOLDER/find_items.robot b/tests/robot/AQL_TESTS/FOLDER/SELECT_PATHS_IN_FOLDER/find_items.robot new file mode 100644 index 00000000..c5d4aef6 --- /dev/null +++ b/tests/robot/AQL_TESTS/FOLDER/SELECT_PATHS_IN_FOLDER/find_items.robot @@ -0,0 +1,52 @@ +*** Settings *** +Documentation CHECK SELECT PATHS IN FOLDER - Find Items +... - Covers: https://github.com/ehrbase/conformance-testing-documentation/blob/main/FOLDER.md#find-items +... - *Precondition:* +... - 1. Upload OPT; 2. Create EHR; +... - 3. Create 2 compositions with conformance_ehrbase.de.v0_max.json and store their compo_ids; +... - 4. Create Directory with folder_multi_compositions.json; +... - 5. Create 1 composition with conformance_ehrbase.de.v0_max.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 + +*** Variables *** +${q} SELECT f/uid/value, f/name/value, f/archetype_node_id, f/items/id/value FROM FOLDER f + + +*** Test Cases *** +Find Items: ${q} + Set Test Variable ${query} ${q} + ${temporary_file} Set Variable + ... ${EXPECTED_JSON_DATA_SETS}/folder/expected_folder_find_items_tmp.json + Set AQL And Execute Ad Hoc Query ${query} + Length Should Be ${resp_body['rows']} 2 + ${expected_file} Set Variable expected_folder_find_items.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_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} + Create Directory For AQL folder_multi_compositions.json has_robot_vars=${TRUE} + Commit Composition For AQL conformance_ehrbase.de.v0_max.json \ No newline at end of file diff --git a/tests/robot/_resources/test_data_sets/aql/data_load/folder/folder_multi_compositions.json b/tests/robot/_resources/test_data_sets/aql/data_load/folder/folder_multi_compositions.json index 83ba2798..c6ed4317 100644 --- a/tests/robot/_resources/test_data_sets/aql/data_load/folder/folder_multi_compositions.json +++ b/tests/robot/_resources/test_data_sets/aql/data_load/folder/folder_multi_compositions.json @@ -1,6 +1,6 @@ { "_type": "FOLDER", - "uuid": { + "uid": { "_type": "HIER_OBJECT_ID", "value": "10e952ca-a5b2-4f24-8d37-59240fd37020" }, diff --git a/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_find_all.json b/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_find_all.json index 6dc282c1..a9703a4b 100644 --- a/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_find_all.json +++ b/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_find_all.json @@ -2,11 +2,11 @@ "meta": { "_type": "RESULTSET", "_schema_version": "1.0.3", - "_created": "2024-09-25T12:12:48.2899056+03:00", - "_executed_aql": "SELECT f/uid/value, f/name/value, f/archetype_node_id, f/items/id/value FROM FOLDER f", + "_created": "2024-09-25T13:23:19.4276296+03:00", + "_executed_aql": "SELECT f/uid/value, f/name/value, f/archetype_node_id FROM FOLDER f", "resultsize": 3 }, - "q": "SELECT f/uid/value, f/name/value, f/archetype_node_id, f/items/id/value FROM FOLDER f", + "q": "SELECT f/uid/value, f/name/value, f/archetype_node_id FROM FOLDER f", "columns": [ { "path": "f/uid/value", @@ -19,30 +19,23 @@ { "path": "f/archetype_node_id", "name": "#2" - }, - { - "path": "f/items/id/value", - "name": "#3" } ], "rows": [ [ "10e952ca-a5b2-4f24-8d37-59240fd37020::local.ehrbase.org::1", "root1", - "openEHR-EHR-FOLDER.generic.v1", - null + "openEHR-EHR-FOLDER.generic.v1" ], [ "d936409e-901f-4994-8d33-ed104d460151", "subfolder1", - "openEHR-EHR-FOLDER.generic.v1", - null + "openEHR-EHR-FOLDER.generic.v1" ], [ "0cc504b1-4d6d-4cd5-81d9-0ef1b870edb3", "subsubfolder1", - "openEHR-EHR-FOLDER.episode_of_care.v1", - null + "openEHR-EHR-FOLDER.episode_of_care.v1" ] ] } \ No newline at end of file diff --git a/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_find_by_item_id.json b/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_folder_find_by_item_id.json similarity index 93% rename from tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_find_by_item_id.json rename to tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_folder_find_by_item_id.json index 23416dc1..c885fa7f 100644 --- a/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_find_by_item_id.json +++ b/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_folder_find_by_item_id.json @@ -2,7 +2,7 @@ "meta": { "_type": "RESULTSET", "_schema_version": "1.0.3", - "_created": "2024-09-25T12:39:47.4116434+03:00", + "_created": "2024-09-25T13:44:38.9005106+03:00", "_executed_aql": "SELECT f/uid/value, f/name/value, f/items/id/value FROM FOLDER f WHERE f/items/id/value = '7c0a9df0-564f-4f34-8e65-92586c64ef56'", "resultsize": 1 }, diff --git a/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_folder_find_items.json b/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_folder_find_items.json new file mode 100644 index 00000000..c037a171 --- /dev/null +++ b/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_folder_find_items.json @@ -0,0 +1,42 @@ +{ + "meta": { + "_type": "RESULTSET", + "_schema_version": "1.0.3", + "_created": "2024-09-25T13:34:03.4040685+03:00", + "_executed_aql": "SELECT f/uid/value, f/name/value, f/archetype_node_id, f/items/id/value FROM FOLDER f", + "resultsize": 2 + }, + "q": "SELECT f/uid/value, f/name/value, f/archetype_node_id, f/items/id/value FROM FOLDER f", + "columns": [ + { + "path": "f/uid/value", + "name": "#0" + }, + { + "path": "f/name/value", + "name": "#1" + }, + { + "path": "f/archetype_node_id", + "name": "#2" + }, + { + "path": "f/items/id/value", + "name": "#3" + } + ], + "rows": [ + [ + "10e952ca-a5b2-4f24-8d37-59240fd37020::local.ehrbase.org::1", + "root1", + "openEHR-EHR-FOLDER.generic.v1", + "${c_uid1}" + ], + [ + "10e952ca-a5b2-4f24-8d37-59240fd37020::local.ehrbase.org::1", + "root1", + "openEHR-EHR-FOLDER.generic.v1", + "${c_uid2}" + ] + ] +} \ No newline at end of file