Skip to content

Commit

Permalink
feat: add Robot tests based on conformance tests docs
Browse files Browse the repository at this point in the history
  • Loading branch information
vladislavploaia committed Sep 25, 2024
1 parent f449e34 commit 7508d3f
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
@@ -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}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"_type": "FOLDER",
"uuid": {
"uid": {
"_type": "HIER_OBJECT_ID",
"value": "10e952ca-a5b2-4f24-8d37-59240fd37020"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
]
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down
Original file line number Diff line number Diff line change
@@ -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}"
]
]
}

0 comments on commit 7508d3f

Please sign in to comment.