diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..13b0b8e --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,48 @@ +version: 2.1 + +jobs: + deployment-and-api-tests: + machine: + image: ubuntu-2004:202010-01 + steps: + - checkout + - run: + name: 'Test Scheduler Build Block API' + command: 'echo testing all examples in /examples against test suite in /test' + - run: + name: Deploy Mock APP for Scheduler BB API and PyTest Containers + command: cd examples/mock && docker-compose up --build -d + - run: + name: Check Status of Mock App and API Testing Containers + command: docker ps + - run: + name: Testing Scheduler BB API + command: 'echo testing using containers' + - run: + name: Check Status of Testing Containers are Deployed + command: docker ps + - run: + name: Run Pytest tests against Register BB Mock to generate test result in Junit XML Format for Test Summary + command: docker exec -i pytest pytest -k smoke -s --junit-xml=/tmp/test-results/pytest-results.xml || true + - run: + name: Run cucumber tests against Register BB Mock to generate test result in JSON Format + command: docker exec -i pytest pytest -k smoke -s --json-report --json-report-indent=4 --json-report-file=/tmp/test-results/smoke_testing_report.json || true + - run: + name: Copy test results to host machine + command: docker cp pytest:/tmp/test-results /tmp + - store_test_results: + path: /tmp/test-results + prefix: junit- + destination: /test-results/ + - store_artifacts: + path: /tmp/test-results + +workflows: + deployment-and-api-tests: + jobs: + - deployment-and-api-tests: + filters: + branches: + only: + - mock_example + diff --git a/api/test.txt b/api/test.txt deleted file mode 100644 index 8b13789..0000000 --- a/api/test.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/examples/mock/docker-compose.yml b/examples/mock/docker-compose.yml new file mode 100644 index 0000000..629d17e --- /dev/null +++ b/examples/mock/docker-compose.yml @@ -0,0 +1,27 @@ +version: "3" +services: + mockoon: + image: mockoon/cli:latest + command: -d /data # this is where the change takes place + container_name: myapi + ports: + - "3000:3000" + networks: + demo: + volumes: + - type: bind + source: ../../api/Scheduler_OpenAPI_17042023_V3.json + target: /data + pytest: + build: + context: ../../test/. + container_name: pytest + tty: true + stdin_open: true + networks: + demo: + + +networks: + demo: + diff --git a/test/Dockerfile b/test/Dockerfile new file mode 100644 index 0000000..0cc34a8 --- /dev/null +++ b/test/Dockerfile @@ -0,0 +1,8 @@ +#FROM joyzoursky/python-chromedriver:latest +#FROM qnib/pytest +FROM python:3.8 +COPY requirnments.txt requirnments.txt +RUN pip3 install -r requirnments.txt +COPY . /test +WORKDIR /test/ +CMD /bin/bash diff --git a/test/features/createaffiliationnew.feature b/test/features/createaffiliationnew.feature new file mode 100644 index 0000000..5a1faee --- /dev/null +++ b/test/features/createaffiliationnew.feature @@ -0,0 +1,44 @@ +@method=POST @endpoint=/affiliation/new/ +Feature: Create a new affiliation of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario: Create a new affiliation for Scheduler API Smoke Test + +Given the requestor Id is "healthngo1" with role as "healthworker" to create a new affiliation +When a POST request for an endpoint /affiliation/new/ is triggered to create new affiliation for scheduler block +Then the result should return affiliation Id as "1" for smoke testing +And response code of POST request is "200" for smoke testing + + + +@unit @happyregression +Scenario Outline: Create a new affiliation for Scheduler API Unit and Regression Happy Testing + +Given the requestor id is "" with role as "" to create an affiliation with its details "" "" for resource of category "" for a schedule on "" from "" to "" +When a POST request for an endpoint /affiliation/new/ is triggered to create new affiliation for scheduler block +Then the result should return affiliation details like "" and "" for requested affiliation +And response code of POST request is "200" + +Examples: + | requestor_id | requestor_role | resource_id | entity_id | resource_category | day_of_week | start_time | end_time | affiliation_name | affiliation_id | + | healthngo1 | healthworker | 12345 | 67890 | physician | monday | 09:00:00 | 17:00:00 | xyz hospital | 1 | + + +@unit @Negativeregression +Scenario Outline: Create a new affiliation for Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor id is "" with role as "" to create an affiliation with its details "" "" for resource of category "" for a schedule on "" from "" to "" +When a POST request for an endpoint /affiliation/new/ is triggered to create new affiliation for scheduler block +Then response code of negative testing POST request for invalid data is "" + + + +Examples: + | requestor_id | requestor_role | resource_id | entity_id | resource_category | day_of_week | start_time | end_time | status_code | + | healthngo1 | healthworker | 12345 | 67890 | physician | monday | 09:00:00 | 17:00:00 | 400 | + | healthngo1 | healthworker | 12345 | 67890 | physician | monday | 17:00:00 | 09:00:00 | 403 | + | healthngo1 | healthworker | resource | 67890 | nurse | monday | 17:00:00 | 09:00:00 | 404 | + + diff --git a/test/features/createalertschedulenew.feature b/test/features/createalertschedulenew.feature new file mode 100644 index 0000000..6c9729c --- /dev/null +++ b/test/features/createalertschedulenew.feature @@ -0,0 +1,43 @@ +@method=POST @endpoint=/alert_schedule/new/ +Feature: Create a new Alert Schedule for Management of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario: Create a new Alert Schedule for Management of Scheduler API Smoke Test + +Given the requestor Id is "healthngo1" with role as "healthworker" to create a new alert schedule +When a POST request for an endpoint /alert_schedule/new/ is triggered to create new alert schedule for scheduler block +Then the result should return alert schedule Id as "1" for smoke testing +And response code of POST request is "200" for smoke testing + + + +@unit @happyregression +Scenario Outline: Create a new Alert Schedule for Management of Scheduler API Unit and Regression Happy Testing + +Given the requestor id is "" with role as "" to create a new alert schedule with event "" for "" with "" within a "" +When a POST request for an endpoint /alert_schedule/new/ is triggered to create new alert schedule for scheduler block +Then the result should return alert details like "" and "" for requested schedule +And response code of POST request is "200" + +Examples: + | requestor_id | requestor_role | event_id | target_category | message_id | alert_datetime | alert_schedule_name | alert_schedule_id | + | healthngo1 | healthworker | 12345 | subscriber | 1 | 2018-02-15T09:00:00 | xyz hospital | 1 | + + +@unit @Negativeregression +Scenario Outline: Create a new Alert Schedule for Management of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor id is "" with role as "" to create a new alert schedule with event "" for "" with "" within a "" +When a POST request for an endpoint /alert_schedule/new/ is triggered to create new alert schedule for scheduler block +Then response code of negative testing POST request for invalid data is "" + + + +Examples: + | requestor_id | requestor_role | event_id | target_category | message_id | alert_datetime | status_code | + | healthngo1 | healthworker | 12345 | subscriber | 1 | 2018-02-15T09:00:00| 400 | + | healthngo1 | healthworker | 12345 | subscriber | 1 | 2018-02-15T09:00:00| 403 | + | healthngo1 | healthworker |12345 | subscriber | 1 | 2018-02-15T09:00:00| 404 | + diff --git a/test/features/createappointmentnew.feature b/test/features/createappointmentnew.feature new file mode 100644 index 0000000..25ebeec --- /dev/null +++ b/test/features/createappointmentnew.feature @@ -0,0 +1,42 @@ +@method=POST @endpoint=/appointment/new/ +Feature: Create a new appointment of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario: Create a new appointment of Scheduler API Smoke Test + +Given the requestor Id is "healthngo1" with role as "healthworker" to create a new appointment +When a POST request for an endpoint /appointment/new/ is triggered to create new appointment for scheduler block +Then the result should return appointment Id as "67890" for smoke testing +And response code of POST request is "200" for smoke testing + + + +@unit @happyregression +Scenario Outline: Create a new appointment of Scheduler API Unit and Regression Happy Testing + +Given the requestor id is "" with role as "" to create a new appointment for an entity with "" and "" for participant of "" "" and "" for a time period "" till "" with deadline "" +When a POST request for an endpoint /appointment/new/ is triggered to create new appointment for scheduler block +Then the result should return appointment details like "" and "" for requested appointment +And response code of POST request is "200" + +Examples: + | requestor_id | requestor_role | entity_id | entity_type | participant_type | participant_id | participant_entity_id | From | To | deadline | appointment_name | appointment_id | + | healthngo1 | healthworker | 1 | doctor_consultation | subscriber | 12345 | 67890 | 2018-02-15T11:00:00 | 2018-02-15T11:30:00 | 2018-02-15T11:10:00 | doctorconsultation | 1 | + + +@unit @Negativeregression +Scenario Outline: Create a new appointment of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor id is "" with role as "" to create a new appointment for an entity with "" and "" for participant of "" "" and "" for a time period "" till "" with deadline "" +When a POST request for an endpoint /appointment/new/ is triggered to create new appointment for scheduler block +Then response code of negative testing POST request for invalid data is "" + + + +Examples: + | requestor_id | requestor_role | entity_id | entity_type | participant_type | participant_id | participant_entity_id | From | To | deadline | status_code | + | healthngo1 | healthworker | 1 | doctor_consultation | subscriber | 12345 | 67890 | 2018-02-15T11:00:00 | 2018-03-15T11:30:00 | 2018-02-15T11:10:00 | 400 | + | healthngo1 | healthworker | 1 | doctor_consultation | subscriber | 12345 | 67890 | 2018-02-15T11:45:00 | 2018-02-15T11:30:00 | 2018-02-15T11:10:00 | 403 | + | healthngo1 | healthworker | 1 | doctor_consultation | subscriber | 12345 | 67890 | 2018-02-15T11:00:00 | 2018-07-15T11:30:00 | 2018-02-15T11:10:00 | 404 | diff --git a/test/features/createlognew.feature b/test/features/createlognew.feature new file mode 100644 index 0000000..be4297b --- /dev/null +++ b/test/features/createlognew.feature @@ -0,0 +1,42 @@ +@method=POST @endpoint=/log/new/ +Feature: Create a new Log of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario: Create a new Log of Scheduler API Smoke Test + +Given the requestor Id is "healthngo1" with role as "healthworker" to create a new log +When a POST request for an endpoint /log/new/ is triggered to create new log for scheduler block +Then the result should return log Id as "1" for smoke testing +And response code of POST request is "200" for smoke testing + + + +@unit @happyregression +Scenario Outline: Create a new Log of Scheduler API Unit and Regression Happy Testing + +Given the requestor id is "" with role as "" to create a log for role "" with its Id "" "" for category "" from time period of "" with data as "" +When a POST request for an endpoint /log/new/ is triggered to create new log for scheduler block +Then the result should return log details like "" and "" for requested log +And response code of POST request is "200" + +Examples: + | requestor_id | requestor_role | logger_role | logger_id | entity_id | log_category | datetime | log_data | log_name | log_id | + | healthngo1 | healthworker | resource | 1 | 67890 | attendence | 2018-02-15T11:00:00 | event_id:12345,subscriber_id:1,token:a2s3x2fer,status:attended | xyz hospital | 1 | + + +@unit @Negativeregression +Scenario Outline: Create a new Log of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor id is "" with role as "" to create a log for role "" with its Id "" "" for category "" from time period of "" with data as "" +When a POST request for an endpoint /log/new/ is triggered to create new log for scheduler block +Then response code of negative testing POST request for invalid data is "" + + + +Examples: + | requestor_id | requestor_role | logger_role | logger_id | entity_id | log_category | datetime | log_data | status_code | + | healthngo1 | healthworker | resource | 1 | 67890 | attendence | 2018-02-15T11:00:00 | event_id:12345,subscriber_id:1,token:a2s3x2fer,status:attended | 400 | + | healthngo1 | healthworker | entity | 67890 | 67890 | attendence | 2018-02-15T11:00:00 | event_id:12345,subscriber_id:1,token:a2s3x2fer,status:attended | 403 | + | healthngo1 | healthworker | subscriber |1 | 67890 | attendence | 2018-02-15T11:00:00 | event_id:12345,subscriber_id:1,token:a2s3x2fer,status:attended | 404 | diff --git a/test/features/createmessagenew.feature b/test/features/createmessagenew.feature new file mode 100644 index 0000000..b4fc300 --- /dev/null +++ b/test/features/createmessagenew.feature @@ -0,0 +1,44 @@ +@method=POST @endpoint=/message/new/ +Feature: Create a new message of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario: Create a new message of Scheduler API Smoke Test + +Given the requestor Id is "healthngo1" with role as "healthworker" to create a new message +When a POST request for an endpoint /message/new/ is triggered to create new message for scheduler block +Then the result should return message Id as "1" for smoke testing +And response code of POST request is "200" for smoke testing + + + +@unit @happyregression +Scenario Outline: Create a new message of Scheduler API Unit and Regression Happy Testing + +Given the requestor id is "" with role as "" to create a message with details like "" "" with message body as "" +When a POST request for an endpoint /message/new/ is triggered to create new message for scheduler block +Then the result should return message details like "" and "" for requested message +And response code of POST request is "200" + +Examples: + | requestor_id | requestor_role | entity_id | category | message_body | message_name | message_id | + | healthngo1 | healthworker | 67890 | reminder | you have a doctor consultatio today | xyz hospital | 1 | + + +@unit @Negativeregression +Scenario Outline: Create a new message of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor id is "" with role as "" to create a message with details like "" "" with message body as "" +When a POST request for an endpoint /message/new/ is triggered to create new message for scheduler block +Then response code of negative testing POST request for invalid data is "" + + + +Examples: + | requestor_id | requestor_role | entity_id | category | message_body | status_code | + | healthngo1 | healthworker | 67890 | reminder | you have a doctor consultatio today | 400 | + | healthngo1 | healthworker | 67890 | appointment | you have a doctor consultatio today | 403 | + | healthngo1 | healthworker | 67890 | invite | you have a doctor consultatio today | 404 | + + diff --git a/test/features/createnewentity.feature b/test/features/createnewentity.feature new file mode 100644 index 0000000..8c6aeaa --- /dev/null +++ b/test/features/createnewentity.feature @@ -0,0 +1,44 @@ + +@method=POST @endpoint=/entity/new/ +Feature: Create a new entity of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario: Create a new entity for Scheduler API Smoke Test + +Given the requestor Id is "healthngo1" with role as "healthworker" to create a new entity +When a POST request for an endpoint /entity/new/ is triggered to create new entity for scheduler block +Then the result should return entity Id as "67890" for smoke testing +And response code of POST request is "200" for smoke testing + + + +@unit @happyregression +Scenario Outline: Create a new entity for Scheduler API Unit and Regression Happy Testing + +Given the requestor id is "" with role as "" to create a entity with name "" for "" with following details like "" "" with "" +When a POST request for an endpoint /entity/new/ is triggered to create new entity for scheduler block +Then the result should return entity details like "" and "" for requested entity +And response code of POST request is "200" + +Examples: + | requestor_id | requestor_role | name | category |phone | email | website | entity_name | entity_id | + | healthngo1 | healthworker | practo | hospital | 9980555504 | abc@gmail.com | www.abc.com | hospital | 67890 | + + +@unit @Negativeregression +Scenario Outline: Create a new entity for Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor id is "" with role as "" to create a entity with name "" for "" with following details like "" "" with "" +When a POST request for an endpoint /entity/new/ is triggered to create new entity for scheduler block +Then response code of negative testing POST request for invalid data is "" + + + +Examples: + | requestor_id | requestor_role | name | category | phone | email | website | status_code | + | healthngo1 | healthworker | practo | hospital | 9980555504 | sree@gmail.com | http://alert.com | 400 | + | healthngo1 | healthworker | practo | education | 9980555504 | sree@gmail.com | http://alert.com | 403 | + | healthngo1 | healthworker | practo | agriculture | 9980555504 | sree@gmail.com | http://alert.com | 404 | + diff --git a/test/features/createnewevent.feature b/test/features/createnewevent.feature new file mode 100644 index 0000000..20083c3 --- /dev/null +++ b/test/features/createnewevent.feature @@ -0,0 +1,43 @@ +@method=POST @endpoint=/event/new +Feature: Create a new event of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario: Create a new event for Scheduler API Smoke Test + +Given the requestor is "healthngoadmin1" with role as "healthworker" to create a new event +When a POST request for an endpoint /event/new is triggered to create new event for scheduler block +Then response code of POST request is "200" for smoke testing + + + +@unit @happyregression +Scenario Outline: Create a new event for Scheduler API Unit and Regression Happy Testing + +Given the requestor is "" with role as "healthworker" to create a new event with following details like "" "" "" for a period "" till "" for a venue in "" "" "" with "" "" +When a POST request for an endpoint /event/new is triggered to create new event for scheduler block +Then the result should return event details as "" "" for requested event +And response code of POST request is "200" + + +Examples: + | requestor_id | requestor_role | name | category | host_entity_id | From | To | street | building | area | lat | long | event_name | event_id | + | healthngoadmin1 | healthworker |doctor_consultation | opd_physician_consultation | 67890 | 2018-02-15T11:00:00 | 2018-02-15T11:30:00 | 7th | xyx | wilsongarden | 0.1 | 0.2 |doctorconsultation | 4524458935 | + + +@unit @Negativeregression +Scenario Outline: Create a new event for Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor is "" with role as "healthworker" to create a new event with following details like "" "" "" for a period "" till "" for a venue in "" "" "" with "" "" +When a POST request for an endpoint /event/new is triggered to create new event for scheduler block +Then response code of negative testing POST request for error is "" + + +Examples: + | requestor_id | requestor_role | name | category | host_entity_id | From | To | street | building | area | lat | long | status_code | + | healthngoadmin1 | healthworker | doctor_consultation | opd_physician_consultation | 67890 | 2018-02-15T11:00:00 | 2018-02-15T11:30:00 | 7th | xyz | manipal | 0.1 | 0.2 | 404 | + | healthngoadmin1 | healthworker | doctor_consultation | opd_physician_consultation | 67890 | 2018-02-15T11:00:00 | 2018-02-15T11:30:00 | 7th | xyz | manipal | 0.1 | 0.2 | 403 | + | healthngoadmin1 | healthworker | doctor_consultation | opd_physician_consultation | 67890 | 2018-02-15T11:00:00 | 2018-02-15T11:30:00 | 7th | xyz | manipal | 0.1 | 0.2 | 400 | + + diff --git a/test/features/createresourcenew.feature b/test/features/createresourcenew.feature new file mode 100644 index 0000000..b4a4900 --- /dev/null +++ b/test/features/createresourcenew.feature @@ -0,0 +1,43 @@ +@method=POST @endpoint=/resource/new/ +Feature: Create a new resource of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario: Create a new resource of Scheduler API Smoke Test + +Given the requestor Id is "healthngo1" with role as "healthworker" to create a new resource +When a POST request for an endpoint /resource/new/ is triggered to create new resource for scheduler block +Then the result should return resource Id as "54321" for smoke testing +And response code of POST request is "200" for smoke testing + + + +@unit @happyregression +Scenario Outline: Create a new resource of Scheduler API Unit and Regression Happy Testing + +Given the requestor id is "" with role as "" to create a resource with name "" for "" with following details like "" "" with "" "" and "" +When a POST request for an endpoint /resource/new/ is triggered to create new resource for scheduler block +Then the result should return resource details like "" and "" for requested resource +And response code of POST request is "200" + +Examples: + | requestor_id | requestor_role | name | category | phone | email | alert_url | alert_preference | status_poll_url | resource_name | resource_id | + | healthngo1 | healthworker | practo | hospital | 9980555504 | abc@gmail.com | psrk@gmail.com | phone | www.doctor1.com | xyz hospital | 67890 | + + +@unit @Negativeregression +Scenario Outline: Create a new resource of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor id is "" with role as "" to create a resource with name "" for "" with following details like "" "" with "" "" and "" +When a POST request for an endpoint /resource/new/ is triggered to create new resource for scheduler block +Then response code of negative testing POST request for invalid data is "" + + + +Examples: + | requestor_id | requestor_role | name | category | phone | email | alert_url | alert_preference | status_poll_url | status_code | + | healthngo1 | healthworker | practo | hospital | 9980555504 | abc@gmail.com | psrk@gmail.com | phone | www.doctor1.com | 400 | + | healthngo1 | healthworker | practo | hospital | 9980555504 | abc@gmail.com | psrk@gmail.com | phone | www.doctor1.com | 403 | + | healthngo1 | healthworker | practo | hospital | 9980555504 | abc@gmail.com | psrk@gmail.com | phone | www.doctor1.com | 404 | + diff --git a/test/features/createsubscribernew.feature b/test/features/createsubscribernew.feature new file mode 100644 index 0000000..efded09 --- /dev/null +++ b/test/features/createsubscribernew.feature @@ -0,0 +1,45 @@ +@method=POST @endpoint=/subscriber/new/ +Feature: Create a new Subscriber of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario: Create a new Subscriber of Scheduler API Smoke Test + +Given the requestor Id is "healthngo1" with role as "healthworker" to create a new subscriber +When a POST request for an endpoint /subscriber/new/ is triggered to create new subscriber for scheduler block +Then the result should return subscriber Id as "12345" for smoke testing +And response code of POST request is "200" for smoke testing + + + +@unit @happyregression +Scenario Outline: Create a new Subscriber of Scheduler API Unit and Regression Happy Testing + +Given the requestor id is "" with role as "" to create a subscriber with name "" for "" with following details like "" "" with "" having "" and "" +When a POST request for an endpoint /subscriber/new/ is triggered to create new subscriber for scheduler block +Then the result should return subscriber details like "" and "" for requested subscriber +And response code of POST request is "200" + +Examples: + | requestor_id | requestor_role | name | category | phone | email | alert_url | alert_preference | status_poll_url | subscriber_name | subscriber_id | + | healthngo1 | healthworker | practo | hospital | 9980555504 | abc@gmail.com | www.abc.com | phone | www.abc.com | xyz hospital | 12345 | + + +@unit @Negativeregression +Scenario Outline: Create a new Subscriber of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor id is "" with role as "" to create a subscriber with name "" for "" with following details like "" "" with "" having "" and "" +When a POST request for an endpoint /subscriber/new/ is triggered to create new subscriber for scheduler block +Then response code of negative testing POST request for invalid data is "" + + + +Examples: + | requestor_id | requestor_role | name | category | phone | email | alert_url | alert_preference | status_poll_url | status_code | + | healthngo1 | healthworker | practo | hospital | 9980555504 | sree@gmail.com | wwww.alert.com | phone | www.abc.com | 400 | + | healthngo1 | healthworker | practo | education | 9980555504 | sree@gmail.com | www.alert.com | email | www.abc.com | 403 | + | healthngo1 | healthworker | practo | agriculture | 9980555504 | sree@gmail.com | www.alert.com | message | www.abc.com | 404 | + | healthngo1 | healthworker | practo | agriculture | 9980555504 | sree@gmail.com | http://alert.com | phone | www.abc.com | 404 | + + diff --git a/test/features/deleteaffiliationnew.feature b/test/features/deleteaffiliationnew.feature new file mode 100644 index 0000000..769d0ee --- /dev/null +++ b/test/features/deleteaffiliationnew.feature @@ -0,0 +1,44 @@ +@method=DELETE @endpoint=/affiliation +Feature: Delete an Affiliation of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario Outline: Delete an Affiliation of Scheduler API Smoke Test + +Given the requestor Id is "" with role as "" for an affiliation_id "" for smoke testing +When a Delete request for an endpoint /affiliation is triggered to delete an affiliation for scheduler block +Then response code of Delete request is "200" for smoke testing + + +Examples: + | requestor_id | requestor_role | affiliation_id | + | healthngo1 | healthworker | 1 | + +@unit @happyregression +Scenario Outline: Delete an Affiliation of Scheduler API Unit and Regression Happy Testing + +Given the requestor Id is "" with role as "" for an affiliation with affiliationId "" +When a Delete request for an endpoint /affiliation is triggered to delete an affiliation for scheduler block +Then response code of Delete request is "200" + +Examples: + | requestor_id | requestor_role | affiliation_id | + | healthngoadmin1 | Organizer | 12345 | + + +@unit @Negativeregression +Scenario Outline: Delete an Affiliation of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor Id is "" with role as "" for an affiliation with affiliationId "" +When a Delete request for an endpoint /affiliation is triggered to delete an affiliation for scheduler block +Then response code of negative testing Delete request for invalid data is "" + + +Examples: + | requestor_id | requestor_role | affiliation_id | status_code | + | healthngo1 | healthworker | 4524453535 | 400 | + | healthngo1 | healthworker | 4524453535 | 403 | + | healthngo1 | healthworker | 4524453535 | 404 | + + diff --git a/test/features/deletealertschedulenew.feature b/test/features/deletealertschedulenew.feature new file mode 100644 index 0000000..248f3f0 --- /dev/null +++ b/test/features/deletealertschedulenew.feature @@ -0,0 +1,44 @@ +@method=DELETE @endpoint=/alert_schedule +Feature: Delete an Alert Schedule for Management of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario Outline: Delete an Alert Schedule for Management of Scheduler API Smoke Test + +Given the requestor Id is "" with role as "" for an alert_schedule_id "" for smoke testing +When a Delete request for an endpoint /alert_schedule is triggered to delete an alert schedule for scheduler block +Then response code of Delete request is "200" for smoke testing + + +Examples: + | requestor_id | requestor_role | alert_schedule_id | + | healthngo1 | healthworker | 4524453535 | + +@unit @happyregression +Scenario Outline: Delete an Alert Schedule for Management of Scheduler API Unit and Regression Happy Testing + +Given the requestor Id is "" with role as "" for an alert_schedule with alert_schedule_Id "" +When a Delete request for an endpoint /alert_schedule is triggered to delete an alert schedule for scheduler block +Then response code of Delete request is "200" + +Examples: + | requestor_id | requestor_role | alert_schedule_id | + | healthngoadmin1 | Organizer | 12345 | + + +@unit @Negativeregression +Scenario Outline: Delete an Alert Schedule for Management of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor Id is "" with role as "" for an alert_schedule with alert_schedule_Id "" +When a Delete request for an endpoint /alert_schedule is triggered to delete an alert schedule for scheduler block +Then response code of negative testing Delete request for invalid data is "" + + +Examples: + | requestor_id | requestor_role | alert_schedule_id | status_code | + | healthngo1 | healthworker | 4524453535 | 400 | + | healthngo1 | healthworker | 4524453535 | 403 | + | healthngo1 | healthworker | 4524453535 | 404 | + + diff --git a/test/features/deleteappointmentnew.feature b/test/features/deleteappointmentnew.feature new file mode 100644 index 0000000..a75b514 --- /dev/null +++ b/test/features/deleteappointmentnew.feature @@ -0,0 +1,45 @@ + +@method=DELETE @endpoint=/appointment +Feature: Delete an appointment of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario Outline: Delete an appointment of Scheduler API Smoke Test + +Given the requestor Id is "" with role as "" for an appointment_id "" for smoke testing +When a Delete request for an endpoint /appointment is triggered to delete an appointment for scheduler block +Then response code of Delete request is "200" for smoke testing + + +Examples: + | requestor_id | requestor_role | appointment_id | + | healthngo1 | healthworker | 1 | + +@unit @happyregression +Scenario Outline: Delete an appointment of Scheduler API Unit and Regression Happy Testing + +Given the requestor Id is "" with role as "" for an appointment with appointmentId "" +When a Delete request for an endpoint /appointment is triggered to delete an appointment for scheduler block +Then response code of Delete request is "200" + +Examples: + | requestor_id | requestor_role | appointment_id | + | healthngoadmin1 | Organizer | 12345 | + + +@unit @Negativeregression +Scenario Outline: Delete an appointment of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor Id is "" with role as "" for an appointment with appointmentId "" +When a Delete request for an endpoint /appointment is triggered to delete an appointment for scheduler block +Then response code of negative testing Delete request for invalid data is "" + + +Examples: + | requestor_id | requestor_role | appointment_id | status_code | + | healthngo1 | healthworker | 4524453535 | 400 | + | healthngo1 | healthworker | 4524453535 | 403 | + | healthngo1 | healthworker | 4524453535 | 404 | + + diff --git a/test/features/deleteentity.feature b/test/features/deleteentity.feature new file mode 100644 index 0000000..2d4fcce --- /dev/null +++ b/test/features/deleteentity.feature @@ -0,0 +1,44 @@ +@method=DELETE @endpoint=/entity +Feature: Delete an Entity of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario Outline: Delete an Entity for Scheduler API Smoke Test + +Given the requestor Id is "" with role as "" for an entity_id "" for smoke testing +When a Delete request for an endpoint /entity is triggered to delete an entity for scheduler block +Then response code of Delete request is "200" for smoke testing + + +Examples: + | requestor_id | requestor_role | entity_id | + | healthngo1 | healthworker | 4524453535 | + +@unit @happyregression +Scenario Outline: Delete an Entity for Scheduler API Unit and Regression Happy Testing + +Given the requestor Id is "" with role as "" for an entity with entityId "" +When a Delete request for an endpoint /entity is triggered to delete an entity for scheduler block +Then response code of Delete request is "200" + +Examples: + | requestor_id | requestor_role | entity_id | + | healthngoadmin1 | Organizer | 12345 | + + +@unit @Negativeregression +Scenario Outline: Delete an Entity for Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor Id is "" with role as "" for an entity with entityId "" +When a Delete request for an endpoint /entity is triggered to delete an entity for scheduler block +Then response code of negative testing Delete request for invalid data is "" + + +Examples: + | requestor_id | requestor_role | entity_id | status_code | + | healthngo1 | healthworker | 4524453535 | 400 | + | healthngo1 | healthworker | 4524453535 | 403 | + | healthngo1 | healthworker | 4524453535 | 404 | + + diff --git a/test/features/deleteevent.feature b/test/features/deleteevent.feature new file mode 100644 index 0000000..9344142 --- /dev/null +++ b/test/features/deleteevent.feature @@ -0,0 +1,44 @@ +@method=DELETE @endpoint=/event +Feature: Delete an Event of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario Outline: Delete an Event for Scheduler API Smoke Test + +Given the requestor Id is "" with role as "" for an event_id "" for smoke testing +When a Delete request for an endpoint /event is triggered to delete an event for scheduler block +Then response code of Delete request is "200" for smoke testing + + +Examples: + | requestor_id | requestor_role | event_id | + | healthngo1 | healthworker | 4524453535 | + +@unit @happyregression +Scenario Outline: Delete an Event for Scheduler API Unit and Regression Happy Testing + +Given the requestor Id is "" with role as "" for an event with eventId "" +When a Delete request for an endpoint /event is triggered to delete an event for scheduler block +Then response code of Delete request is "200" + +Examples: + | requestor_id | requestor_role | event_id | + | healthngoadmin1 | Organizer | 12345 | + + +@unit @Negativeregression +Scenario Outline: Delete an Event for Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor Id is "" with role as "" for an event with eventId "" +When a Delete request for an endpoint /event is triggered to delete an event for scheduler block +Then response code of negative testing Delete request for invalid data is "" + + +Examples: + | requestor_id | requestor_role | event_id | status_code | + | healthngo1 | healthworker | 4524453535 | 400 | + | healthngo1 | healthworker | 4524453535 | 403 | + | healthngo1 | healthworker | 4524453535 | 404 | + + diff --git a/test/features/deletelognew.feature b/test/features/deletelognew.feature new file mode 100644 index 0000000..c95f7fa --- /dev/null +++ b/test/features/deletelognew.feature @@ -0,0 +1,44 @@ +@method=DELETE @endpoint=/log +Feature: Delete a log details of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario Outline: Delete a log details of Scheduler API Smoke Test + +Given the requestor Id is "" with role as "" for a log_id "" for smoke testing +When a Delete request for an endpoint /log is triggered to delete a log for scheduler block +Then response code of Delete request is "200" for smoke testing + + +Examples: + | requestor_id | requestor_role | log_id | + | healthngo1 | healthworker | 1 | + +@unit @happyregression +Scenario Outline: Delete a log details of Scheduler API Unit and Regression Happy Testing + +Given the requestor Id is "" with role as "" for a log_id "" +When a Delete request for an endpoint /log is triggered to delete a log for scheduler block +Then response code of Delete request is "200" + +Examples: + | requestor_id | requestor_role | log_id | + | healthngoadmin1 | Organizer | 12345 | + + +@unit @Negativeregression +Scenario Outline: Delete a log details of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor Id is "" with role as "" for a log_id "" +When a Delete request for an endpoint /log is triggered to delete a log for scheduler block +Then response code of negative testing Delete request for invalid data is "" + + +Examples: + | requestor_id | requestor_role | log_id | status_code | + | healthngo1 | healthworker | 4524453535 | 400 | + | healthngo1 | healthworker | 4524453535 | 403 | + | healthngo1 | healthworker | 4524453535 | 404 | + + diff --git a/test/features/deletemessagenew.feature b/test/features/deletemessagenew.feature new file mode 100644 index 0000000..95fdd3a --- /dev/null +++ b/test/features/deletemessagenew.feature @@ -0,0 +1,44 @@ +@method=DELETE @endpoint=/message +Feature: Delete a message of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario Outline: Delete a message of Scheduler API Smoke Test + +Given the requestor Id is "" with role as "" for a message_id "" for smoke testing +When a Delete request for an endpoint /message is triggered to delete a message for scheduler block +Then response code of Delete request is "200" for smoke testing + + +Examples: + | requestor_id | requestor_role | message_id | + | healthngo1 | healthworker | 1 | + +@unit @happyregression +Scenario Outline: Delete a message of Scheduler API Unit and Regression Happy Testing + +Given the requestor Id is "" with role as "" for a message_id "" +When a Delete request for an endpoint /message is triggered to delete a message for scheduler block +Then response code of Delete request is "200" + +Examples: + | requestor_id | requestor_role | message_id | + | healthngoadmin1 | Organizer | 12345 | + + +@unit @Negativeregression +Scenario Outline: Delete a message of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor Id is "" with role as "" for a message_id "" +When a Delete request for an endpoint /message is triggered to delete a message for scheduler block +Then response code of negative testing Delete request for invalid data is "" + + +Examples: + | requestor_id | requestor_role | message_id | status_code | + | healthngo1 | healthworker | 4524453535 | 400 | + | healthngo1 | healthworker | 4524453535 | 403 | + | healthngo1 | healthworker | 4524453535 | 404 | + + diff --git a/test/features/deleteresourcenew.feature b/test/features/deleteresourcenew.feature new file mode 100644 index 0000000..934e712 --- /dev/null +++ b/test/features/deleteresourcenew.feature @@ -0,0 +1,44 @@ +@method=DELETE @endpoint=/resource +Feature: Delete a resource of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario Outline: Delete a resource of Scheduler API Smoke Test + +Given the requestor Id is "" with role as "" for a resource_id "" for smoke testing +When a Delete request for an endpoint /resource is triggered to delete a resource for scheduler block +Then response code of Delete request is "200" for smoke testing + + +Examples: + | requestor_id | requestor_role | resource_id | + | healthngo1 | healthworker | 54321 | + +@unit @happyregression +Scenario Outline: Delete a resource of Scheduler API Unit and Regression Happy Testing + +Given the requestor Id is "" with role as "" for a resource_id "" +When a Delete request for an endpoint /resource is triggered to delete a resource for scheduler block +Then response code of Delete request is "200" + +Examples: + | requestor_id | requestor_role | resource_id | + | healthngoadmin1 | Organizer | 12345 | + + +@unit @Negativeregression +Scenario Outline: Delete a resource of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor Id is "" with role as "" for a resource_id "" +When a Delete request for an endpoint /resource is triggered to delete a resource for scheduler block +Then response code of negative testing Delete request for invalid data is "" + + +Examples: + | requestor_id | requestor_role | resource_id | status_code | + | healthngo1 | healthworker | 4524453535 | 400 | + | healthngo1 | healthworker | 4524453535 | 403 | + | healthngo1 | healthworker | 4524453535 | 404 | + + diff --git a/test/features/deletesubscribernew.feature b/test/features/deletesubscribernew.feature new file mode 100644 index 0000000..4b98c1e --- /dev/null +++ b/test/features/deletesubscribernew.feature @@ -0,0 +1,44 @@ +@method=DELETE @endpoint=/subscriber +Feature: Delete a subscriber of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario Outline: Delete a subscriber for Scheduler API Smoke Test + +Given the requestor Id is "" with role as "" for an subscriber_id "" for smoke testing +When a Delete request for an endpoint /subscriber is triggered to delete a subscriber for scheduler block +Then response code of Delete request is "200" for smoke testing + + +Examples: + | requestor_id | requestor_role | subscriber_id | + | healthngo1 | healthworker | 12345 | + +@unit @happyregression +Scenario Outline: Delete a subscriber for Scheduler API Unit and Regression Happy Testing + +Given the requestor Id is "" with role as "" for a subscriber with subscriberId "" +When a Delete request for an endpoint /subscriber is triggered to delete a subscriber for scheduler block +Then response code of Delete request is "200" + +Examples: + | requestor_id | requestor_role | subscriber_id | + | healthngoadmin1 | Organizer | 12345 | + + +@unit @Negativeregression +Scenario Outline: Delete a subscriber for Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor Id is "" with role as "" for a subscriber with subscriberId "" +When a Delete request for an endpoint /subscriber is triggered to delete a subscriber for scheduler block +Then response code of negative testing Delete request for invalid data is "" + + +Examples: + | requestor_id | requestor_role | subscriber_id | status_code | + | healthngo1 | healthworker | 4524453535 | 400 | + | healthngo1 | healthworker | 4524453535 | 403 | + | healthngo1 | healthworker | 4524453535 | 404 | + + diff --git a/test/features/getaffiliationlistnew.feature b/test/features/getaffiliationlistnew.feature new file mode 100644 index 0000000..b691ac7 --- /dev/null +++ b/test/features/getaffiliationlistnew.feature @@ -0,0 +1,53 @@ +@method=GET @endpoint=/affiliation/list_details/ +Feature: Get Affiliation List Details of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario Outline: Get Affiliation List Details of Scheduler API Smoke Test + +Given the requestor Id is "" with role as "" for an affiliation_id "" for smoke testing +When a GET request for an endpoint /affiliation/list_details/ is triggered to get details of a affiliation list +Then response code of GET request is "200" for smoke testing + + + +Examples: + | requestor_id | requestor_role | affiliation_id | + | healthngo1 | healthworker | 1 | + + + + + +@unit @happyregression +Scenario Outline: Get Affiliation List Details of Scheduler API Unit and Regression Happy Testing + +Given the requestor Id is "" with role as "" for a affiliation_id "" with details filter for "" and requesting for affiliation details for "" "" "" "" and "" +When a GET request for an endpoint /affiliation/list_details/ is triggered to get details of a affiliation list +Then the result should return following details of entity with its name "" "" "" "" and "" +And response code of GET request is "200" + +Examples: + | requestor_id | requestor_role | affiliation_id | filter_affiliation_id | required_category | required_affiliation_id | required_entity_id | required_From | required_To | affiliation_id | category | entity_id | From | To | + | healthngo1 | healthworker | 1 | 1 | true | true | true | true | true | 1 | physician | 67890 | 2018-02-15T11:00:00 | 2018-02-15T11:30:00 | + + +@unit @Negativeregression +Scenario Outline: Get Affiliation List Details of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor Id is "" with role as "" for a affiliation_id "" with details filter for "" and requesting for affiliation details for "" "" "" "" and "" +When a GET request for an endpoint /affiliation/list_details/ is triggered to get details of a affiliation list +Then response code of negative testing GET request for invalid data is "" + + + +Examples: + | requestor_id | requestor_role | affiliation_id | filter_affiliation_id | required_category | required_affiliation_id | required_entity_id | required_From | required_To | status_code | + | healthngo1 | healthworker | myresource | 4524453535 | false | true | true | true | true | 400 | + | healthngo1 | healthworker | 4524453535 | 4524453535 | true | true | true | true | no | 403 | + | healthngo1 | healthworker | 4524453535 | 4524453535 | true | true | true | true | yes | 404 | + + + + diff --git a/test/features/getalertschedulelistnew.feature b/test/features/getalertschedulelistnew.feature new file mode 100644 index 0000000..92fb4c0 --- /dev/null +++ b/test/features/getalertschedulelistnew.feature @@ -0,0 +1,46 @@ +@method=GET @endpoint=/alert_schedule/list_details/ +Feature: Get Alert List Details of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario Outline: Get Alert List Details of Scheduler API Smoke Test +Given the requestor Id is "" with role as "" for an alert_schedule_id "" for smoke testing +When a GET request for an endpoint /alert_schedule/list_details/ is triggered to get details of an alert schedule list +Then response code of GET request is "200" for smoke testing + +Examples: + | requestor_id | requestor_role | alert_schedule_id | + | healthngo1 | healthworker | 1 | + + +@unit @happyregression +Scenario Outline: Get Alert List Details of Scheduler API Unit and Regression Happy Testing + +Given the requestor Id is "" with role as "" for an alert schedule list with details filter for "" and requesting for alert schedule details for "" "" "" and "" +When a GET request for an endpoint /alert_schedule/list_details/ is triggered to get details of an alert schedule list +Then the result should return following details of entity with its name "" "" "" and "" +And response code of GET request is "200" + +Examples: + | requestor_id | requestor_role | filter_alert_schedule_id | required_target_category | required_entity_id | required_alert_schedule_id | required_message_id | target_category | entity_id | alert_schedule_id | message_id | + | healthngo1 | healthworker | 1 | true | true | true | true | subscriber | 67890 | 1 | 1 | + +@unit @Negativeregression +Scenario Outline: Get Alert List Details of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor Id is "" with role as "" for an alert schedule list with details filter for "" and requesting for alert schedule details for "" "" "" and "" +When a GET request for an endpoint /alert_schedule/list_details/ is triggered to get details of an alert schedule list +Then response code of negative testing GET request for invalid data is "" + + + +Examples: + | requestor_id | requestor_role | filter_alert_schedule_id | required_target_category | required_entity_id | required_alert_schedule_id | required_message_id | status_code | + | healthngo1 | healthworker | myresource | true | false | false | true | 400 | + | healthngo1 | healthworker | 4524453535 | false | true | true | true | 403 | + | healthngo1 | healthworker | 4524453535 | no | true | true | true | 404 | + + + + diff --git a/test/features/getappointmentlistnew.feature b/test/features/getappointmentlistnew.feature new file mode 100644 index 0000000..594b6e3 --- /dev/null +++ b/test/features/getappointmentlistnew.feature @@ -0,0 +1,46 @@ +@method=GET @endpoint=/appointment/list_details/ +Feature: Get Appointment List Details of Scheduler API +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario Outline: Get Appointment List Details of Scheduler API Smoke Test + +Given the requestor Id is "" with role as "" for an appointment_id "" for smoke testing +When a GET request for an endpoint /appointment/list_details/ is triggered to get details of a appointment list +Then response code of GET request is "200" for smoke testing + +Examples: + | requestor_id | requestor_role | appointment_id| + | healthngo1 | healthworker | 1 | + +@unit @happyregression +Scenario Outline: Get Appointment List Details of Scheduler API Unit and Regression Happy Testing + +Given the requestor Id is "" with role as "" for an appointment_id "" with details filter for "" and requesting for appointment details for "" "" "" "" "" "" and "" +When a GET request for an endpoint /appointment/list_details/ is triggered to get details of a appointment list +Then the result should return following details of entity with its name "" "" "" "" "" "" "" and "" +And response code of GET request is "200" + +Examples: + | requestor_id | requestor_role | appointment_id | filter_appointment_id | required_event_type | required_event_id | required_participant_type | required_participant_id | required_appointment_id | required_From | required_To | appointment_id | participant_type | participant_id | event_type | event_id | From | To | + | healthngo1 | healthworker | 1 | 1 | true | true | true | true | true | true | true | 1 | subscriber | 12345 | doctor_consultation | 1 | 2018-02-15T11:00:00 | 2018-02-15T11:30:00 | + + +@unit @Negativeregression +Scenario Outline: Get Appointment List Details of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor Id is "" with role as "" for an appointment_id "" with details filter for "" and requesting for appointment details for "" "" "" "" "" "" and "" +When a GET request for an endpoint /appointment/list_details/ is triggered to get details of a appointment list +Then response code of negative testing GET request for invalid data is "" + + + +Examples: + | requestor_id | requestor_role | appointment_id | filter_appointment_id | required_participant_type | required_participant_id | required_appointment_id | required_event_id | required_event_type | required_From | required_To | status_code | + | healthngo1 | healthworker | myresource | 4524453535 | false | true | true | true | true | true | yes | 400 | + | healthngo1 | healthworker | 4524453535 | 4524453535 | true | yes | true | true | true | true | true | 403 | + | healthngo1 | healthworker | 4524453535 | 4524453535 | true | no | true | true | true | false | yes | 404 | + + + + diff --git a/test/features/getentitylistnew.feature b/test/features/getentitylistnew.feature new file mode 100644 index 0000000..dfbd39c --- /dev/null +++ b/test/features/getentitylistnew.feature @@ -0,0 +1,50 @@ +@method=GET @endpoint=/entity/list_details/ +Feature: Get Entity List Details of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario Outline: Get Entity List Details for Scheduler API Smoke Test + +Given the requestor Id is "" with role as "" for an entity_id "" for smoke testing +When a GET request for an endpoint /entity/list_details/ is triggered to get details of an entity list +Then response code of GET request is "200" for smoke testing + + + +Examples: + | requestor_id | requestor_role | entity_id | + | healthngo1 | healthworker | 4524453535 | + + +@unit @happyregression +Scenario Outline: Get Entity List Details for Scheduler API Unit and Regression Happy Testing + +Given the requestor Id is "" with role as "" for an entity_id "" with details filter for "" and requesting for entity details for "" "" "required_name>" and "" +When a GET request for an endpoint /entity/list_details/ is triggered to get details of an entity list +Then the result should return following details of entity with its name "" "" "" "" "" and "" +And response code of GET request is "200" + +Examples: + | requestor_id | requestor_role | entity_id | filter_entity_id | required_category | required_entity_id | required_name | required_email | name | category | entity_id | phone | email | website | + | healthngo1 | healthworker | 4524453535| 4524453535 | true | true | true | true |doctor_consultation | opd_physician_consultation | 67890 | 9980555504 | abc@gmail.com | http://abc.com | + + +@unit @Negativeregression +Scenario Outline: Get Entity List Details for Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor Id is "" with role as "" for an entity_id "" with details filter for "" and requesting for entity details for "" "" "required_name>" and "" +When a GET request for an endpoint /entity/list_details/ is triggered to get details of an entity list +Then response code of negative testing GET request for invalid data is "" + + + +Examples: + | requestor_id | requestor_role | entity_id |filter_entity_id | required_category | required_entity_id | required_name | required_email | status_code | + | healthngo1 | healthworker | myresource | 4524453535 | false | true | true | true | 400 | + | healthngo1 | healthworker | 4524453535 | 4524453535 | true | true | true | true | 403 | + | healthngo1 | healthworker | 4524453535 | 4524453535 | true | true | true | true | 404 | + + + + diff --git a/test/features/geteventlistnew.feature b/test/features/geteventlistnew.feature new file mode 100644 index 0000000..de34ecc --- /dev/null +++ b/test/features/geteventlistnew.feature @@ -0,0 +1,43 @@ +@method=GET @endpoint=/event/list_details/ +Feature: Get Event List Details of Scheduler API +Gherkin feature files for GovStack Scheduler services +@smoke +Scenario Outline: Get Event List Details for Scheduler API Smoke Test + +Given the requestor Id is "" with role as "" for an event_id "" for smoke testing +When a GET request for an endpoint /event/list_details/ is triggered to get details of an event list +Then response code of GET request is "200" for smoke testing + +Examples: + | requestor_id | requestor_role | event_id | + | healthngo1 | healthworker | 4524453535| + +@unit @happyregression +Scenario Outline: Get Event List Details for Scheduler API Unit and Regression Happy Testing + +Given the requestor Id is "" with role as "" for an event_id "" with details filter for "" and requesting for event details for "" "" "" and "" +When a GET request for an endpoint /event/list_details/ is triggered to get details of an event list +Then the result should return following details of entity with its name "" "" "" "" and "" +And response code of GET request is "200" + +Examples: + | requestor_id | requestor_role | event_id | filter_event_id | required_category | required_host_entity_id | required_name | required_venue | name | category | event_id | host_entity_id | venue | + | healthngo1 | healthworker | 12345 | 12345 | true | true | true | true | doctor_consultation | opd_physician_consultation | 12345 | 67890 | 7th Street, Wilson Garden, Bangalore | + + +@unit @Negativeregression +Scenario Outline: Get Event List Details for Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor Id is "" with role as "" for an event_id "" with details filter for "" and requesting for event details for "" "" "" and "" +When a GET request for an endpoint /event/list_details/ is triggered to get details of an event list +Then response code of negative testing GET request for invalid data is "" + +Examples: + | requestor_id | requestor_role | event_id | filter_event_id | required_category | required_host_entity_id | required_name | required_venue | status_code | + | healthngo1 | healthworker | myresource | 4524453535 | false | yes | true | true | 400 | + | healthngo1 | healthworker | 4524453535 | 4524453535 | true | true | no | true | 403 | + | healthngo1 | healthworker | 4524453535 | 4524453535 | true | false | true | yes | 404 | + + + + diff --git a/test/features/getloglistnew.feature b/test/features/getloglistnew.feature new file mode 100644 index 0000000..520c687 --- /dev/null +++ b/test/features/getloglistnew.feature @@ -0,0 +1,45 @@ +@method=GET @endpoint=/log/list_details/ +Feature: Get Log List Details of Scheduler API +Gherkin feature files for GovStack Scheduler services +@smoke +Scenario Outline: Get Log List Details of Scheduler API Smoke Test + +Given the requestor Id is "" with role as "" for an log_id "" for smoke testing +When a GET request for an endpoint /log/list_details/ is triggered to get details of a log list +Then response code of GET request is "200" for smoke testing +Examples: + | requestor_id | requestor_role | log_id | + | healthngo1 | healthworker | 1 | + + +@unit @happyregression +Scenario Outline: Get Log List Details of Scheduler API Unit and Regression Happy Testing + +Given the requestor Id is "" with role as "" for a log_id "" with details filter for "" and requesting for log details for "" "" "" "" and "" +When a GET request for an endpoint /log/list_details/ is triggered to get details of a log list +Then the result should return following details of entity with its name "" "" "" "" and "" +And response code of GET request is "200" + +Examples: + | requestor_id | requestor_role | log_id | filter_log_id | required_category | required_log_id | required_entity_id | required_From | required_To | log_id | category | entity_id | From | To | + | healthngo1 | healthworker | 1 | 1 | true | true | true | true | true | 1 | attendence | 67890 | 2018-02-15T11:00:00 | 2018-02-15T11:30:00 | + + +@unit @Negativeregression +Scenario Outline: Get Log List Details of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor Id is "" with role as "" for a log_id "" with details filter for "" and requesting for log details for "" "" "" "" and "" +When a GET request for an endpoint /log/list_details/ is triggered to get details of a log list +Then response code of negative testing GET request for invalid data is "" + + + +Examples: + | requestor_id | requestor_role | log_id | filter_log_id | required_category | required_log_id | required_entity_id | required_From | required_To | status_code | + | healthngo1 | healthworker | myresource | 4524453535 | false | true | true | true | true | 400 | + | healthngo1 | healthworker | 4524453535 | 4524453535 | true | true | true | true | no | 403 | + | healthngo1 | healthworker | 4524453535 | 4524453535 | true | true | true | true | yes | 404 | + + + + diff --git a/test/features/getmessagelistnew.feature b/test/features/getmessagelistnew.feature new file mode 100644 index 0000000..46031be --- /dev/null +++ b/test/features/getmessagelistnew.feature @@ -0,0 +1,47 @@ +@method=GET @endpoint=/message/list_details/ +Feature: Get Message List Details of Scheduler API + +Gherkin feature files for GovStack Scheduler services +@smoke +Scenario Outline: Get Message List Details of Scheduler API Smoke Test + +Given the requestor Id is "" with role as "" for an message_id "" for smoke testing +When a GET request for an endpoint /message/list_details/ is triggered to get details of a messages list +Then response code of GET request is "200" for smoke testing + +Examples: + | requestor_id | requestor_role | message_id | + | healthngo1 | healthworker | 1 | + + +@unit @happyregression +Scenario Outline: Get Message List Details of Scheduler API Unit and Regression Happy Testing + +Given the requestor Id is "" with role as "" for a message_id "" with details filter for "" and requesting for message details for "" "" "" and "" +When a GET request for an endpoint /message/list_details/ is triggered to get details of a messages list +Then the result should return following details of entity with its name "" "" "" and "" +And response code of GET request is "200" + +Examples: + | requestor_id | requestor_role | message_id | filter_message_id | required_category | required_message_id | required_entity_id | required_message_body | message_id | category | entity_id | message_body | + | healthngo1 | healthworker | 1 | 1 | true | true | true | true |1 | reminder | 1 | you have doctor consultation today | + + +@unit @Negativeregression +Scenario Outline: Get Message List Details of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor Id is "" with role as "" for a message_id "" with details filter for "" and requesting for message details for "" "" "" and "" +When a GET request for an endpoint /message/list_details/ is triggered to get details of a messages list +Then response code of negative testing GET request for invalid data is "" + + + +Examples: + | requestor_id | requestor_role | message_id | filter_message_id | required_category | required_message_id | required_entity_id | required_message_body | status_code | + | healthngo1 | healthworker | myresource | 4524453535 | false | true | true | true | 400 | + | healthngo1 | healthworker | 4524453535 | 4524453535 | true | true | true | true | 403 | + | healthngo1 | healthworker | 4524453535 | 4524453535 | true | true | true | true | 404 | + + + + diff --git a/test/features/getresourceavailabalitydetailsnew.feature b/test/features/getresourceavailabalitydetailsnew.feature new file mode 100644 index 0000000..895b189 --- /dev/null +++ b/test/features/getresourceavailabalitydetailsnew.feature @@ -0,0 +1,43 @@ +@method=GET @endpoint=/resource/availabality/ +Feature: Get Resource Availabality Details of Scheduler API +Gherkin feature files for GovStack Scheduler services +@smoke +Scenario Outline: Get Resource Availabality Details of Scheduler API Smoke Test + +Given the requestor Id is "" with role as "" for an resource_id "" for smoke testing +When a GET request for an endpoint /resource/availabality/ is triggered to get details of a resource availabality list +Then response code of GET request is "200" for smoke testing + +Examples: + | requestor_id| requestor_role | resource_id| + | healthngo1 | healthworker | 1 | + +@unit @happyregression +Scenario Outline: Get Resource Availabality Details of Scheduler API Unit and Regression Happy Testing + +Given the requestor Id is "" with role as "" for an resource_id "" with entity Id "" for category "" for a date period from "" to "" +When a GET request for an endpoint /resource/availabality/ is triggered to get details of a resource availabality list +Then the result should return following details of entity with its name "" "" and "" +And response code of GET request is "200" + +Examples: + | requestor_id | requestor_role | resource_id | Entity_id | category | From | To | resource_id | resource_name | free_slots | + | healthngo1 | healthworker | 1 | 67890 | doctor | 2018-02-14T09:00:00 | 2018-02-18T13:30:00 | 1 | abc | [2018-02-15T11:00:00to2018-02-15T11:09:00:00],[2018-02-22T11:00:00to2018-02-22T11:17:00:00] | + + +@unit @Negativeregression +Scenario Outline: Get Resource Availabality Details of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor Id is "" with role as "" for an resource_id "" with entity Id "" for category "" for a date period from "" to "" +When a GET request for an endpoint /resource/availabality/ is triggered to get details of a resource availabality list +Then response code of negative testing GET request for invalid data is "" + +Examples: + | requestor_id | requestor_role | resource_id | Entity_id | category | From | To | status_code | + | healthngo1 | healthworker | myresource | 4524453535| lawyer | 2018-02-18T13:30:00 | 2018-02-14T09:00:00 | 400 | + | healthngo1 | healthworker | 4524453535 | 4524453535| doctor | 2018-02-18T13:30:00 | 2018-02-14T09:00:00 | 403 | + | healthngo1 | healthworker | 4524453535 | 4524453535| academician | 2018-02-18T13:30:00 | 2018-02-14T09:00:00 | 404 | + + + + diff --git a/test/features/getresourcelistnew.feature b/test/features/getresourcelistnew.feature new file mode 100644 index 0000000..27add54 --- /dev/null +++ b/test/features/getresourcelistnew.feature @@ -0,0 +1,42 @@ +@method=GET @endpoint=/resource/list_details/ +Feature: Get Resource List Details of Scheduler API +Gherkin feature files for GovStack Scheduler services +@smoke +Scenario Outline: Get Resource List Details for Scheduler API Smoke Test + +Given the requestor Id is "" with role as "" for an resource_id "" for smoke testing +When a GET request for an endpoint /resource/list_details/ is triggered to get details of a resources list +Then response code of GET request is "200" for smoke testing +Examples: + | requestor_id| requestor_role | resource_id| + | healthngo1 | healthworker | 54321 | + +@unit @happyregression +Scenario Outline: Get Resource List Details for Scheduler API Unit and Regression Happy Testing + +Given the requestor Id is "" with role as "" for an resource_id "" with details filter for "" and requesting for resource details for "" "" "" and "" +When a GET request for an endpoint /resource/list_details/ is triggered to get details of a resources list +Then the result should return following details of entity with its name "" "" "" "" and "" +And response code of GET request is "200" + +Examples: + | requestor_id | requestor_role | resource_id | filter_resource_id | required_category | required_resource_id | required_name | required_email | name | category | resource_id | phone | email | + | healthngo1 | healthworker | 54321 |54321 | true | true | true | true |doctor_consultation | opd_physician_consultation | 54321 | 9980555504 | abc@gmail.com | + + +@unit @Negativeregression +Scenario Outline: Get Resource List Details for Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor Id is "" with role as "" for an resource_id "" with details filter for "" and requesting for resource details for "" "" "" and "" +When a GET request for an endpoint /resource/list_details/ is triggered to get details of a resources list +Then response code of negative testing GET request for invalid data is "" + +Examples: + | requestor_id | requestor_role | resource_id | filter_resource_id | required_category | required_resource_id | required_name | required_phone | required_email | status_code | + | healthngo1 | healthworker | myresource | 4524453535 | false | true | true | true | true | 400 | + | healthngo1 | healthworker | 4524453535 | 4524453535 | true | true | true | true | false | 403 | + | healthngo1 | healthworker | 4524453535 | 4524453535 | true | true | true | true | yes | 404 | + + + + diff --git a/test/features/getsubscriberlistnew.feature b/test/features/getsubscriberlistnew.feature new file mode 100644 index 0000000..730f702 --- /dev/null +++ b/test/features/getsubscriberlistnew.feature @@ -0,0 +1,47 @@ +@method=GET @endpoint=/subscriber/list_details/ +Feature: Get Subscriber List Details of Scheduler API +Gherkin feature files for GovStack Scheduler services +@smoke +Scenario Outline: Get Subscriber List Details of Scheduler API Smoke Test + +Given the requestor Id is "" with role as "" for a subscriber_id "" for smoke testing +When a GET request for an endpoint /subscriber/list_details/ is triggered to get details of a subscribers list +Then response code of GET request is "200" for smoke testing + +Examples: + | requestor_id | requestor_role | subscriber_id | + | healthngo1 | healthworker | 12345 | + + + +@unit @happyregression +Scenario Outline: Get Subscriber List Details of Scheduler API Unit and Regression Happy Testing + +Given the requestor Id is "" with role as "" for a subscriber_id "" with details filter for "" and requesting for subscriber details for "" "" "" "" and "" +When a GET request for an endpoint /subscriber/list_details/ is triggered to get details of a subscribers list +Then the result should return following details of entity with its name "" "" "" "" and "" +And response code of GET request is "200" + +Examples: + | requestor_id | requestor_role | subscriber_id | filter_subscriber_id | required_category | required_subscriber_id | required_name | required_email | required_phone | name | category | resource_id | phone | email | + | healthngo1 | healthworker | 12345 | 12345 | true | true | true | true | true |abc | patient | 12345 | 9980555504 | abc@gmail.com | + + +@unit @Negativeregression +Scenario Outline: Get Subscriber List Details of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor Id is "" with role as "" for a subscriber_id "" with details filter for "" and requesting for subscriber details for "" "" "" "" and "" +When a GET request for an endpoint /subscriber/list_details/ is triggered to get details of a subscribers list +Then response code of negative testing GET request for invalid data is "" + + + +Examples: + | requestor_id | requestor_role | subscriber_id | filter_subscriber_id | required_category | required_subscriber_id | required_name | required_phone | required_email | status_code | + | healthngo1 | healthworker | myresource | 4524453535 | false | true | true | true | true | 400 | + | healthngo1 | healthworker | 4524453535 | 4524453535 | true | true | true | true | false | 403 | + | healthngo1 | healthworker | 4524453535 | 4524453535 | true | true | true | true | yes | 404 | + + + + diff --git a/test/features/updateaffiliationnew.feature b/test/features/updateaffiliationnew.feature new file mode 100644 index 0000000..3742d95 --- /dev/null +++ b/test/features/updateaffiliationnew.feature @@ -0,0 +1,35 @@ +@method=PUT @endpoint=/affiliation/modifications/ +Feature: Update an affiliation details of Scheduler API + +Gherkin feature files for GovStack Scheduler services +@smoke +Scenario: Update an affiliation details of Scheduler API Smoke Test + +Given the requestor id is "healthngo1" with role as "healthworker" to update an affiliation with its ID "1" +When an Update request for an endpoint /affiliation/modifications/ is triggered to update existing affiliation details for scheduler block +Then response code of Update request is "200" for smoke testing + +@unit @happyregression +Scenario Outline: Update an affiliation details of Scheduler API Unit and Regression Happy Testing + +Given the requestor id is "" with role as "" for an affiliation with Id "" to update an affiliation details like "" "" for resource of category "" for a schedule on "" from "" to "" +When an Update request for an endpoint /affiliation/modifications/ is triggered to update existing affiliation details for scheduler block +Then response code of Update request is "200" + +Examples: + | requestor_id | requestor_role | affiliation_id | resource_id | entity_id | resource_category | day_of_week | start_time | end_time | + | healthngo1 | healthworker | 1 | 12345 | 67890 | physician | monday | 09:00:00 | 17:00:00 | + + +@unit @Negativeregression +Scenario Outline: Update an affiliation details of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor id is "" with role as "" for an affiliation with Id "" to update an affiliation details like "" "" for resource of category "" for a schedule on "" from "" to "" +When an Update request for an endpoint /affiliation/modifications/ is triggered to update existing affiliation details for scheduler block +Then response code of negative testing an Update request for invalid data is "" + +Examples: + | requestor_id | requestor_role | affiliation_id | resource_id | entity_id | resource_category | day_of_week | start_time | end_time | status_code | + | healthngo1 | healthworker | 0 | 12345 | 67890 | physician | monday | 09:00:00 | 17:00:00 | 400 | + | healthngo1 | healthworker | 333 | 12345 | 67890 | physician | monday | 17:00:00 | 09:00:00 | 403 | + | healthngo1 | healthworker | my |resource | 67890 | nurse | monday | 17:00:00 | 09:00:00 | 404 | diff --git a/test/features/updatealertschedulenew.feature b/test/features/updatealertschedulenew.feature new file mode 100644 index 0000000..3d7380c --- /dev/null +++ b/test/features/updatealertschedulenew.feature @@ -0,0 +1,39 @@ +@method=PUT @endpoint=/alert_schedule/modifications/ +Feature: Update an Alert Schedule for Management of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario: Update an Alert Schedule for Management of Scheduler API Smoke Test + +Given the requestor id is "healthngo1" with role as "healthworker" to update an alert schedule with its ID "2" +When an Update request for an endpoint /alert_schedule/modifications/ is triggered to update existing alert schedule for scheduler block +Then response code of Update request is "200" for smoke testing + +@unit @happyregression +Scenario Outline: Update an Alert Schedule for Management of Scheduler API Unit and Regression Happy Testing + +Given the requestor id is "" with role as "" for an alert schedule with Id "" to update an alert with its details like "" for "" with "" within a "" +When an Update request for an endpoint /alert_schedule/modifications/ is triggered to update existing alert schedule for scheduler block +Then response code of Update request is "200" + + Examples: + | requestor_id | requestor_role | alert_schedule_id | event_id | target_category | message_id | alert_datetime | + | healthngo1 | healthworker | 2 | 12345 | subscriber | 1 | 2018-02-15T09:00:00 | + + +@unit @Negativeregression +Scenario Outline: Update an Alert Schedule for Management of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor id is "" with role as "" for an alert schedule with Id "" to update an alert with its details like "" for "" with "" within a "" +When an Update request for an endpoint /alert_schedule/modifications/ is triggered to update existing alert schedule for scheduler block +Then response code of negative testing an Update request for invalid data is "" + +Examples: + | requestor_id | requestor_role | alert_schedule_id | event_id | target_category | message_id | alert_datetime | status_code | + | healthngo1 | healthworker | 2 | 12345 | subscriber | 1 | 2018-02-15T09:00:00 | 400 | + | healthngo1 | healthworker | 1 | 12345 | subscriber | 1 | 2018-02-15T09:00:00 | 403 | + | healthngo1 | healthworker | 2 | 12345 | subscriber | 1 | 2018-02-15T09:00:00 | 404 | + + + diff --git a/test/features/updateappointmentnew.feature b/test/features/updateappointmentnew.feature new file mode 100644 index 0000000..8c61781 --- /dev/null +++ b/test/features/updateappointmentnew.feature @@ -0,0 +1,38 @@ +@method=PUT @endpoint=/appointment/modifications/ +Feature: Update an appointment details of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario: Update an appointment details for Scheduler API Smoke Test + +Given the requestor id is "healthngo1" with role as "healthworker" to update an appointment details with its ID "4524453535" +When an Update request for an endpoint /appointment/modifications/ is triggered to update existing appointment details for scheduler block +Then response code of Update request is "200" for smoke testing + +@unit @happyregression +Scenario Outline: Update an appointment details for Scheduler API Unit and Regression Happy Testing + +Given the requestor id is "" with role as "" for an appointment with Id "" to update an appointment with its details like "" and "" for participant of "" "" and "" for a time period "" till "" with deadline "" +When an Update request for an endpoint /appointment/modifications/ is triggered to update existing appointment details for scheduler block +Then response code of Update request is "200" + +Examples: + | requestor_id | requestor_role | appointment_id | entity_id | entity_type | participant_type | participant_id | participant_entity_id | From | To | deadline | + | healthngo1 | healthworker | 1 |1 | doctor_consultation | subscriber | 12345 | 67890 | 2018-02-15T11:00:00 | 2018-02-15T11:30:00 | 2018-02-15T11:10:00 | + +@unit @Negativeregression +Scenario Outline: Update an appointment details for Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor id is "" with role as "" for an appointment with Id "" to update an appointment with its details like "" and "" for participant of "" "" and "" for a time period "" till "" with deadline "" +When an Update request for an endpoint /appointment/modifications/ is triggered to update existing appointment details for scheduler block +Then response code of negative testing an Update request for invalid data is "" + +Examples: + | requestor_id | requestor_role | appointment_id | entity_id | entity_type | participant_type | participant_id | participant_entity_id | From | To | deadline | status_code | + | healthngo1 | healthworker | 3456 | 1 | doctor_consultation | subscriber | 12345 | 67890 | 2018-02-15T11:00:00 | 2018-03-15T11:30:00 | 2018-02-15T11:10:00 | 400 | + | healthngo1 | healthworker | 1 | 1 | doctor_consultation | subscriber | 12345 | 67890 | 2018-02-15T11:45:00 | 2018-02-15T11:30:00 | 2018-02-15T11:10:00 | 403 | + | healthngo1 | healthworker | 12345 | 1 | doctor_consultation | subscriber | 12345 | 67890 | 2018-02-15T11:00:00 | 2018-07-15T11:30:00 | 2018-02-15T11:10:00 | 404 | + + + diff --git a/test/features/updateentitynew.feature b/test/features/updateentitynew.feature new file mode 100644 index 0000000..61fbd8d --- /dev/null +++ b/test/features/updateentitynew.feature @@ -0,0 +1,37 @@ +@method=PUT @endpoint=/entity/modifications/ +Feature: Update an entity of Scheduler API + +Gherkin feature files for GovStack Scheduler services +@smoke +Scenario: Update an entity for Scheduler API Smoke Test +Given the requestor id is "healthngo1" with role as "healthworker" to update an entity with its ID "4524453535" +When an Update request for an endpoint /entity/modifications/ is triggered to update existing entity for scheduler block +Then response code of Update request is "200" for smoke testing + +@unit @happyregression +Scenario Outline: Update an entity for Scheduler API Unit and Regression Happy Testing + +Given the requestor id is "" with role as "" for an entity with Id "" to update an entity with name "" for "" with following details like "" "" with "" +When an Update request for an endpoint /entity/modifications/ is triggered to update existing entity for scheduler block +Then response code of Update request is "200" + + Examples: + | requestor_id | requestor_role | entity_id | name | category | phone | email | website | + | healthngo1 | healthworker | 67890 | practo | hospital | 9980555504| abc@gmail.com | www.abc.com | + + +@unit @Negativeregression +Scenario Outline: Update an entity for Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor id is "" with role as "" for an entity with Id "" to update an entity with name "" for "" with following details like "" "" with "" +When an Update request for an endpoint /entity/modifications/ is triggered to update existing entity for scheduler block +Then response code of negative testing an Update request for invalid data is "" + +Examples: + | requestor_id | requestor_role | entity_id | name | category | phone | email | website | status_code | + | healthngo1 | healthworker | 67890 | practo | hospital | 9980555504 | sree@gmail.com | http://alert.com | 400 | + | healthngo1 | healthworker | 67890 | practo | education | 9980555504 | sree@gmail.com | http://alert.com | 403 | + | healthngo1 | healthworker | 67890 | practo | agriculture| 9980555504 | sree@gmail.com | http://alert.com | 404 | + + + diff --git a/test/features/updateevent.feature b/test/features/updateevent.feature new file mode 100644 index 0000000..ea12e54 --- /dev/null +++ b/test/features/updateevent.feature @@ -0,0 +1,39 @@ +@method=PUT @endpoint=/event/modifications/ +Feature: Update an event of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario: Update an event for Scheduler API Smoke Test + +Given the requestor id is "healthngo1" with role as "healthworker" to update an event with its ID "4524453535" +When an Update request for an endpoint /event/modifications/ is triggered to update existing event for scheduler block +Then response code of Update request is "200" for smoke testing + +@unit @happyregression +Scenario Outline: Update an event for Scheduler API Unit and Regression Happy Testing + +Given the requestor id is "" with role as "" for an event with Id "" to update an event with name "" "" "" for a period "" till "" for a venue in "" "" "" with "" "" +When an Update request for an endpoint /event/modifications/ is triggered to update existing event for scheduler block +Then response code of Update request is "200" + + Examples: + | requestor_id | requestor_role | event_id | name | category | host_entity_id | From | To | street | building | area | lat | long | + | healthngoadmin1 | healthworker | 4524458935 | doctor_consultation | opd_physician_consultation | 67890 | 2018-02-15T11:00:00 | 2018-02-15T11:30:00 | 7th | xyx | wilsongarden | 0.1 | 0.2 | + + +@unit @Negativeregression +Scenario Outline: Update an event for Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor id is "" with role as "" for an event with Id "" to update an event with name "" "" "" for a period "" till "" for a venue in "" "" "" with "" "" +When an Update request for an endpoint /event/modifications/ is triggered to update existing event for scheduler block +Then response code of negative testing an Update request for invalid data is "" + + +Examples: + | requestor_id | requestor_role | event_id | name | category | host_entity_id | From | To | street | building | area | lat | long | status_code | + | healthngo1 | healthworker | 4524453535| doctor_consultation | opd_physician_consultation | 67890 | 2018-02-15T11:00:00 | 2018-02-15T11:30:00 | 7th | xyx | wilsongarden | 0.1 | 0.2 | 400 | + | healthngo1 | healthworker | 4524453535| doctor_consultation | opd_physician_consultation | 67890 | 2018-02-15T11:00:00 | 2018-02-15T11:30:00 | 7th | xyx | wilsongarden | 0.1 | 0.2 | 403 | + | healthngo1 | healthworker | 4524453535| doctor_consultation | opd_physician_consultation | 67890 | 2018-02-15T11:00:00 | 2018-02-15T11:30:00 | 7th | xyx | wilsongarden | 0.1 | 0.2 | 404 | + + diff --git a/test/features/updatelognew.feature b/test/features/updatelognew.feature new file mode 100644 index 0000000..ba1e173 --- /dev/null +++ b/test/features/updatelognew.feature @@ -0,0 +1,34 @@ +@method=PUT @endpoint=/log/modifications/ +Feature: Update a log details of Scheduler API + +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario: Update a log details of Scheduler API Smoke Test +Given the requestor id is "healthngo1" with role as "healthworker" to update a log with its ID "1" +When an Update request for an endpoint /log/modifications/ is triggered to update existing log details for scheduler block +Then response code of Update request is "200" for smoke testing + +@unit @happyregression +Scenario Outline: Update a log details of Scheduler API Unit and Regression Happy Testing + +Given the requestor id is "" with role as "" for a log with Id "" to update a log details for role "" with its Id "" "" for category "" from time period of "" with data as "" +When an Update request for an endpoint /log/modifications/ is triggered to update existing log details for scheduler block +Then response code of Update request is "200" +Examples: + | requestor_id | requestor_role | log_id | logger_role | logger_id | entity_id | log_category | datetime | log_data | + | healthngo1 | healthworker | 1 | resource | 1 | 67890 | attendence | 2018-02-15T11:00:00 | event_id:12345,subscriber_id:1,token:a2s3x2fer,status:attended | + +@unit @Negativeregression +Scenario Outline: Update a log details of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor id is "" with role as "" for a log with Id "" to update a log details for role "" with its Id "" "" for category "" from time period of "" with data as "" +When an Update request for an endpoint /log/modifications/ is triggered to update existing log details for scheduler block +Then response code of negative testing an Update request for invalid data is "" + +Examples: + | requestor_id | requestor_role | log_id | logger_role | logger_id | entity_id | log_category | datetime | log_data | status_code | + | healthngo1 | healthworker | 54321 | resource | 1 | 67890 | attendence | 2018-02-15T11:00:00 | event_id:12345,subscriber_id:1,token:a2s3x2fer,status:attended | 400 | + | healthngo1 | healthworker | mylog | 67890 | resource | 1 | attendence | 2018-02-15T11:00:00 | event_id:12345,subscriber_id:1,token:a2s3x2fer,status:attended | 403 | + | healthngo1 | healthworker | 67890 | 67890 |resource | 67890 | attendence | 2018-02-15T11:00:00 | event_id:12345,subscriber_id:1,token:a2s3x2fer,status:attended | 404 | + diff --git a/test/features/updatemessagenew.feature b/test/features/updatemessagenew.feature new file mode 100644 index 0000000..472e5b2 --- /dev/null +++ b/test/features/updatemessagenew.feature @@ -0,0 +1,34 @@ +@method=PUT @endpoint=/message/modifications/ +Feature: Update a message of Scheduler API +Gherkin feature files for GovStack Scheduler services +@smoke +Scenario: Update a message of Scheduler API Smoke Test + +Given the requestor id is "healthngo1" with role as "healthworker" to update a message with its ID "1" +When an Update request for an endpoint /message/modifications/ is triggered to update existing message details for scheduler block +Then response code of Update request is "200" for smoke testing + +@unit @happyregression +Scenario Outline: Update a message of Scheduler API Unit and Regression Happy Testing + +Given the requestor id is "" with role as "" for a message with Id "" to update a message details like "" "" and "" +When an Update request for an endpoint /message/modifications/ is triggered to update existing message details for scheduler block +Then response code of Update request is "200" +Examples: + | requestor_id | requestor_role | message_id | entity_id | category | message_body | + | healthngo1 | healthworker | 1 | 67890 | reminder | you have a doctor consultatio today | + + +@unit @Negativeregression +Scenario Outline: Update a message of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor id is "" with role as "" for a message with Id "" to update a message details like "" "" and "" +When an Update request for an endpoint /message/modifications/ is triggered to update existing message details for scheduler block +Then response code of negative testing an Update request for invalid data is "" + +Examples: + | requestor_id | requestor_role | message_id | entity_id | category | message_body | status_code | + | healthngo1 | healthworker | 54321 | 67890 | reminder | you have a doctor consultatio today | 400 | + | healthngo1 | healthworker | 67890 | 67890 | reminder | you have a doctor consultatio today | 403 | + | healthngo1 | healthworker | 67890 | 67890 | reminder | you have a doctor consultatio today | 404 | + diff --git a/test/features/updateresourcenew.feature b/test/features/updateresourcenew.feature new file mode 100644 index 0000000..e0881d1 --- /dev/null +++ b/test/features/updateresourcenew.feature @@ -0,0 +1,38 @@ +@method=PUT @endpoint=/resource/modifications/ +Feature: Update a resource of Scheduler API +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario Outline: Update a resource for Scheduler API Smoke Test + +Given the requestor id is "healthngo1" with role as "healthworker" to update a resource with its ID "54321" +When an Update request for an endpoint /resource/modifications/ is triggered to update existing resource for scheduler block +Then response code of Update request is "200" for smoke testing + +@unit @happyregression +Scenario Outline: Update a resource for Scheduler API Unit and Regression Happy Testing + +Given the requestor id is "" with role as "" for a resource with Id "" to update a resource details like "" for "" with "" "" "" "" and "" +When an Update request for an endpoint /resource/modifications/ is triggered to update existing resource for scheduler block +Then response code of Update request is "200" + +Examples: + | requestor_id | requestor_role | resource_id | name | category | phone | email | alert_url | alert_preference | status_poll_url | + | healthngo1 | healthworker | 54321 |practo | hospital | 9980555504 | abc@gmail.com | psrk@gmail.com | phone | www.doctor1.com | + + +@unit @Negativeregression +Scenario Outline: Update a resource for Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor id is "" with role as "" for a resource with Id "" to update a resource details like "" for "" with "" "" "" "" and "" +When an Update request for an endpoint /resource/modifications/ is triggered to update existing resource for scheduler block +Then response code of negative testing an Update request for invalid data is "" + +Examples: + | requestor_id | requestor_role | resource_id | name | category | phone | email | alert_url | alert_preference | status_poll_url | status_code | + | healthngo1 | healthworker | 54321 | practo | hospital | 9980555504 | abc@gmail.com | psrk@gmail.com | phone | www.doctor1.com | 400 | + | healthngo1 | healthworker | 67890 | practo | hospital | 9980555504 | abc@gmail.com | psrk@gmail.com | phone | www.doctor1.com | 403 | + | healthngo1 | healthworker | 67890 | practo | hospital | 9980555504 | abc@gmail.com | psrk@gmail.com | phone | www.doctor1.com | 404 | + + + diff --git a/test/features/updatesubscribernew.feature b/test/features/updatesubscribernew.feature new file mode 100644 index 0000000..0e17c25 --- /dev/null +++ b/test/features/updatesubscribernew.feature @@ -0,0 +1,37 @@ +@method=PUT @endpoint=/subscriber/modifications/ +Feature: Update a subscriber details of Scheduler API +Gherkin feature files for GovStack Scheduler services + +@smoke +Scenario: Update a subscriber details of Scheduler API Smoke Test +Given the requestor id is "healthngo1" with role as "healthworker" to update a subscriber details with its ID "12345" +When an Update request for an endpoint /subscriber/modifications/ is triggered to update existing subscriber details for scheduler block +Then response code of Update request is "200" for smoke testing + +@unit @happyregression +Scenario Outline: Update a subscriber details of Scheduler API Unit and Regression Happy Testing + +Given the requestor id is "" with role as "" for a subscriber with Id "" to update a subscriber details name "" for "" with following details like "" "" with "" having "" and "" +When an Update request for an endpoint /subscriber/modifications/ is triggered to update existing subscriber details for scheduler block +Then response code of Update request is "200" +Examples: + | requestor_id | requestor_role | subscriber_id | name | category | phone | email | alert_url | alert_preference | status_poll_url | + | healthngo1 | healthworker | 12345 |practo | hospital | 9980555504 | abc@gmail.com | www.abc.com | phone | www.abc.com | + + +@unit @Negativeregression +Scenario Outline: Update a subscriber details of Scheduler API Unit and Regression Negative Testing + +Given the invalid inputs for the requestor id is "" with role as "" for a subscriber with Id "" to update a subscriber details name "" for "" with following details like "" "" with "" having "" and "" +When an Update request for an endpoint /subscriber/modifications/ is triggered to update existing subscriber details for scheduler block +Then response code of negative testing an Update request for invalid data is "" + +Examples: + | requestor_id | requestor_role | subscriber_id | name | category | phone | email | alert_url | alert_preference | status_poll_url | status_code | + | healthngo1 | healthworker | hello | practo | hospital | 9980555504 | sree@gmail.com | wwww.alert.com | phone | www.abc.com | 400 | + | healthngo1 | healthworker | 3456 | practo | education | 9980555504 | sree@gmail.com | www.alert.com | email | www.abc.com | 403 | + | healthngo1 | healthworker | 1234 | practo | agriculture | 9980555504 | sree@gmail.com | www.alert.com | message | www.abc.com | 404 | + | healthngo1 | healthworker | 4567 | practo | agriculture | 9980555504 | sree@gmail.com | http://alert.com | phone | www.abc.com | 404 | + + + diff --git a/test/plan.md b/test/plan.md deleted file mode 100644 index b8746b2..0000000 --- a/test/plan.md +++ /dev/null @@ -1,14 +0,0 @@ -# Test plan for the _____________ building block. - -1. a -2. b -3. c - -## Notes - -At least three levels of testing... - -1. can the BB be deployed via docker-compose? -2. can the BB interact with the IM? -3. can an adaptor be deployed alongside it to test API compliance? -4. do the required APIs respond to the required inputs and provide the required responses? diff --git a/test/requirnments.txt b/test/requirnments.txt new file mode 100644 index 0000000..49f090b --- /dev/null +++ b/test/requirnments.txt @@ -0,0 +1,10 @@ +fastapi +uvicorn +python-multipart +pytest +pytest-bdd +requests +#selenium +#webdriver_manager +pytest-html +pytest-json-report diff --git a/test/step_deps/test_create_affiliation_new.py b/test/step_deps/test_create_affiliation_new.py new file mode 100644 index 0000000..c410896 --- /dev/null +++ b/test/step_deps/test_create_affiliation_new.py @@ -0,0 +1,93 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +#API_HOME = 'http://myapi:3000/entity/create_entity/' +API_HOME = 'http://myapi:3000/affiliation/new' + +# Scenarios + +scenarios('../features/createaffiliationnew.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor Id is "{healthngo1}" with role as "{healthworker}" to create a new affiliation'), target_fixture='smoke_post_request') +def smoke_post_request(healthngo1,healthworker): + data = {'requestor_id': healthngo1, 'requestor_role': healthworker} + response = requests.post(API_HOME, data = data) + print(response.url) + print(response.text) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor id is "{requestor_id}" with role as "{requestor_role}" to create an affiliation with its details "{resource_id}" "{entity_id}" for resource of category "{resource_category}" for a schedule on "{day_of_week}" from "{start_time}" to "{end_time}"'), target_fixture='unit_post_request') +def unit_post_request(requestor_id, requestor_role,resource_id, entity_id, resource_category,day_of_week, start_time, end_time ): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'affiliation_details[entity_id]': entity_id, 'affiliation_details[resource_id]': resource_id, 'affiliation_details[resource_category]': resource_category, 'affiliation_details[work_days_hours][day_of_week]': day_of_week, 'affiliation_details[work_days_hours][start_time]': start_time, 'affiliation_details[work_days_hours][end_time]':end_time} + response = requests.post(API_HOME, data = data) + print(data) + print(response.url) + print(response.text) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor id is "{requestor_id}" with role as "{requestor_role}" to create an affiliation with its details "{resource_id}" "{entity_id}" for resource of category "{resource_category}" for a schedule on "{day_of_week}" from "{start_time}" to "{end_time}"'), target_fixture='neg_post_request') +def neg_post_request(requestor_id, requestor_role,resource_id, entity_id, resource_category,day_of_week, start_time, end_time): + + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'affiliation_details[entity_id]': entity_id, 'affiliation_details[resource_id]': resource_id, 'affiliation_details[resource_category]': resource_category, 'affiliation_details[work_days_hours][day_of_week]': day_of_week, 'affiliation_details[work_days_hours][start_time]': start_time, 'affiliation_details[work_days_hours][end_time]':end_time} + response = requests.post(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + + +@then(parsers.parse('the result should return affiliation Id as "{affiliation_id:d}" for smoke testing')) +def unit_response_assert(smoke_post_request,affiliation_id): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_response = smoke_post_request.json() + print(assert_response) + print(type(assert_response.split(",", 1))) + print(assert_response.split(",", 1)[1]) + print(affiliation_id) + assert affiliation_id == affiliation_id + +@then(parsers.parse('the result should return affiliation details like "{affiliation_id}" and "{affiliation_name}" for requested affiliation')) +def unit_response_assert(unit_post_request, affiliation_name, affiliation_id): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_response = unit_post_request.json() + print(assert_response) + print(type(assert_response.split(",", 1))) + print(assert_response.split(",", 1)[1]) + print(affiliation_id) + assert affiliation_id == affiliation_id + +@when(parsers.parse('a POST request for an endpoint /affiliation/new/ is triggered to create new affiliation for scheduler block'), target_fixture = 'post_request') +def post_request(): + pass + +@then(parsers.parse('response code of POST request is "{code:d}" for smoke testing')) +def smoke_post_response_code(smoke_post_request, code): + assert smoke_post_request.status_code == code + +@then(parsers.parse('response code of POST request is "{code:d}"')) +def unit_post_response_code(unit_post_request, code): + assert unit_post_request.status_code == code + + +@then(parsers.parse('response code of negative testing POST request for invalid data is "{status_code:d}"')) +def neg_post_response_code(neg_post_request, status_code): + assert neg_post_request.status_code != status_code diff --git a/test/step_deps/test_create_alert_schedule_new.py b/test/step_deps/test_create_alert_schedule_new.py new file mode 100644 index 0000000..575e43a --- /dev/null +++ b/test/step_deps/test_create_alert_schedule_new.py @@ -0,0 +1,93 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +#API_HOME = 'http://myapi:3000/entity/create_entity/' +API_HOME = 'http://myapi:3000/alert_schedule/new' + +# Scenarios + +scenarios('../features/createalertschedulenew.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor Id is "{healthngo1}" with role as "{healthworker}" to create a new alert schedule'), target_fixture='smoke_post_request') +def smoke_post_request(healthngo1,healthworker): + data = {'requestor_id': healthngo1, 'requestor_role': healthworker} + response = requests.post(API_HOME, data = data) + print(response.url) + print(response.text) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor id is "{requestor_id}" with role as "{requestor_role}" to create a new alert schedule with event "{event_id}" for "{target_category}" with "{message_id}" within a "{alert_datetime}"'), target_fixture='unit_post_request') +def unit_post_request(requestor_id, requestor_role, event_id,target_category,message_id,alert_datetime): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'alert_schedule_details[event_id]': event_id, 'alert_schedule_details[target_category]': target_category, 'alert_schedule_details[message_id]': message_id, 'alert_schedule_details[alert_datetime]': alert_datetime} + response = requests.post(API_HOME, data = data) + print(data) + print(response.url) + print(response.text) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor id is "{requestor_id}" with role as "{requestor_role}" to create a new alert schedule with event "{event_id}" for "{target_category}" with "{message_id}" within a "{alert_datetime}"'), target_fixture='neg_post_request') +def neg_post_request(requestor_id, requestor_role, event_id,target_category,message_id,alert_datetime): + + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'alert_schedule_details[event_id]': event_id, 'alert_schedule_details[target_category]': target_category, 'alert_schedule_details[message_id]': message_id, 'alert_schedule_details[alert_datetime]': alert_datetime} + response = requests.post(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + + +@then(parsers.parse('the result should return alert schedule Id as "{alert_schedule_id:d}" for smoke testing')) +def unit_response_assert(smoke_post_request,alert_schedule_id): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_response = smoke_post_request.json() + print(assert_response) + print(type(assert_response.split(",", 1))) + print(assert_response.split(",", 1)[1]) + print(alert_schedule_id) + assert alert_schedule_id == alert_schedule_id + +@then(parsers.parse('the result should return alert details like "{alert_schedule_id}" and "{alert_schedule_name}" for requested schedule')) +def unit_response_assert(unit_post_request, alert_schedule_id, alert_schedule_name): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_response = unit_post_request.json() + print(assert_response) + print(type(assert_response.split(",", 1))) + print(assert_response.split(",", 1)[1]) + print(alert_schedule_id) + assert alert_schedule_id == alert_schedule_id + +@when(parsers.parse('a POST request for an endpoint /alert_schedule/new/ is triggered to create new alert schedule for scheduler block'), target_fixture = 'post_request') +def post_request(): + pass + +@then(parsers.parse('response code of POST request is "{code:d}" for smoke testing')) +def smoke_post_response_code(smoke_post_request, code): + assert smoke_post_request.status_code == code + +@then(parsers.parse('response code of POST request is "{code:d}"')) +def unit_post_response_code(unit_post_request, code): + assert unit_post_request.status_code == code + + +@then(parsers.parse('response code of negative testing POST request for invalid data is "{status_code:d}"')) +def neg_post_response_code(neg_post_request, status_code): + assert neg_post_request.status_code != status_code diff --git a/test/step_deps/test_create_appointment_new.py b/test/step_deps/test_create_appointment_new.py new file mode 100644 index 0000000..3c524c6 --- /dev/null +++ b/test/step_deps/test_create_appointment_new.py @@ -0,0 +1,93 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +#API_HOME = 'http://myapi:3000/entity/create_entity/' +API_HOME = 'http://myapi:3000/appointment/new' + +# Scenarios + +scenarios('../features/createappointmentnew.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor Id is "{healthngo1}" with role as "{healthworker}" to create a new appointment'), target_fixture='smoke_post_request') +def smoke_post_request(healthngo1,healthworker): + data = {'requestor_id': healthngo1, 'requestor_role': healthworker} + response = requests.post(API_HOME, data = data) + print(response.url) + print(response.text) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor id is "{requestor_id}" with role as "{requestor_role}" to create a new appointment for an entity with "{entity_id}" and "{entity_type}" for participant of "{participant_type}" "{participant_id}" and "{participant_entity_id}" for a time period "{From}" till "{To}" with deadline "{deadline}"'), target_fixture='unit_post_request') +def unit_post_request(requestor_id, requestor_role, entity_id, entity_type, participant_type, participant_id, participant_entity_id, From, To, deadline): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'appointment_details[entity_id]': entity_id, 'appointment_details[entity_type]': entity_type, 'appointment_details[participant_type]': participant_type, 'appointment_details[participant_id]': participant_id, 'appointment_details[participant_entity_id]': participant_entity_id, 'appointment_details[From]':From,'appointment_details[To]':To, 'appointment_details[deadline]': deadline} + response = requests.post(API_HOME, data = data) + print(data) + print(response.url) + print(response.text) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor id is "{requestor_id}" with role as "{requestor_role}" to create a new appointment for an entity with "{entity_id}" and "{entity_type}" for participant of "{participant_type}" "{participant_id}" and "{participant_entity_id}" for a time period "{From}" till "{To}" with deadline "{deadline}"'), target_fixture='neg_post_request') +def neg_post_request(requestor_id, requestor_role, entity_id, entity_type, participant_type, participant_id, participant_entity_id, From, To, deadline): + + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'appointment_details[entity_id]': entity_id, 'appointment_details[entity_type]': entity_type, 'appointment_details[participant_type]': participant_type, 'appointment_details[participant_id]': participant_id, 'appointment_details[participant_entity_id]': participant_entity_id, 'appointment_details[From]':From,'appointment_details[To]':To, 'appointment_details[deadline]': deadline} + response = requests.post(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + + +@then(parsers.parse('the result should return appointment Id as "{appointment_id:d}" for smoke testing')) +def unit_response_assert(smoke_post_request,appointment_id): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_response = smoke_post_request.json() + print(assert_response) + print(type(assert_response.split(",", 1))) + print(assert_response.split(",", 1)[1]) + print(appointment_id) + assert appointment_id == appointment_id + +@then(parsers.parse('the result should return appointment details like "{appointment_id}" and "{appointment_name}" for requested appointment')) +def unit_response_assert(unit_post_request, appointment_name, appointment_id): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_response = unit_post_request.json() + print(assert_response) + print(type(assert_response.split(",", 1))) + print(assert_response.split(",", 1)[1]) + print(appointment_id) + assert appointment_id == appointment_id + +@when(parsers.parse('a POST request for an endpoint /appointment/new/ is triggered to create new appointment for scheduler block'), target_fixture = 'post_request') +def post_request(): + pass + +@then(parsers.parse('response code of POST request is "{code:d}" for smoke testing')) +def smoke_post_response_code(smoke_post_request, code): + assert smoke_post_request.status_code == code + +@then(parsers.parse('response code of POST request is "{code:d}"')) +def unit_post_response_code(unit_post_request, code): + assert unit_post_request.status_code == code + + +@then(parsers.parse('response code of negative testing POST request for invalid data is "{status_code:d}"')) +def neg_post_response_code(neg_post_request, status_code): + assert neg_post_request.status_code != status_code diff --git a/test/step_deps/test_create_entity_new.py b/test/step_deps/test_create_entity_new.py new file mode 100644 index 0000000..cff7e2e --- /dev/null +++ b/test/step_deps/test_create_entity_new.py @@ -0,0 +1,93 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +#API_HOME = 'http://myapi:3000/entity/create_entity/' +API_HOME = 'http://myapi:3000/entity/new' + +# Scenarios + +scenarios('../features/createnewentity.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor Id is "{healthngo1}" with role as "{healthworker}" to create a new entity'), target_fixture='smoke_post_request') +def smoke_post_request(healthngo1,healthworker): + data = {'requestor_id': healthngo1, 'requestor_role': healthworker} + response = requests.post(API_HOME, data = data) + print(response.url) + print(response.text) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor id is "{requestor_id}" with role as "{requestor_role}" to create a entity with name "{name}" for "{category}" with following details like "{phone}" "{email}" with "{website}"'), target_fixture='unit_post_request') +def unit_post_request(requestor_id, requestor_role, name, category, phone, email, website ): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'details[name]': name, 'details[category]': category, 'details[phone]': phone, 'details[email]': email, 'details[website]':website} + response = requests.post(API_HOME, data = data) + print(data) + print(response.url) + print(response.text) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor id is "{requestor_id}" with role as "{requestor_role}" to create a entity with name "{name}" for "{category}" with following details like "{phone}" "{email}" with "{website}"'), target_fixture='neg_post_request') +def neg_post_request(requestor_id, requestor_role, name, category, phone, email, website): + + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'details[name]': name, 'details[category]': category, 'details[phone]': phone, 'details[email]': email, 'details[website]':website} + response = requests.post(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + + +@then(parsers.parse('the result should return entity Id as "{entity_id:d}" for smoke testing')) +def unit_response_assert(smoke_post_request,entity_id): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_response = smoke_post_request.json() + print(assert_response) + print(type(assert_response.split(",", 1))) + print(assert_response.split(",", 1)[1]) + print(entity_id) + assert entity_id == entity_id + +@then(parsers.parse('the result should return entity details like "{entity_id}" and "{entity_name}" for requested entity')) +def unit_response_assert(unit_post_request, entity_name, entity_id): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_response = unit_post_request.json() + print(assert_response) + print(type(assert_response.split(",", 1))) + print(assert_response.split(",", 1)[1]) + print(entity_id) + assert entity_id == entity_id + +@when(parsers.parse('a POST request for an endpoint /entity/new/ is triggered to create new entity for scheduler block'), target_fixture = 'post_request') +def post_request(): + pass + +@then(parsers.parse('response code of POST request is "{code:d}" for smoke testing')) +def smoke_post_response_code(smoke_post_request, code): + assert smoke_post_request.status_code == code + +@then(parsers.parse('response code of POST request is "{code:d}"')) +def unit_post_response_code(unit_post_request, code): + assert unit_post_request.status_code == code + + +@then(parsers.parse('response code of negative testing POST request for invalid data is "{status_code:d}"')) +def neg_post_response_code(neg_post_request, status_code): + assert neg_post_request.status_code != status_code diff --git a/test/step_deps/test_create_event_new.py b/test/step_deps/test_create_event_new.py new file mode 100644 index 0000000..dcedf42 --- /dev/null +++ b/test/step_deps/test_create_event_new.py @@ -0,0 +1,83 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +#API_HOME = 'http://myapi:3000/entity/create_entity/' +API_HOME = 'http://myapi:3000/event/new' + +# Scenarios + +scenarios('../features/createnewevent.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor is "{healthngoadmin1}" with role as "{healthworker}" to create a new event'), target_fixture='smoke_post_request') +def smoke_post_request(healthngoadmin1,healthworker): + data = {'requestor_id': healthngoadmin1, 'requestor_role': healthworker} + response = requests.post(API_HOME, data = data) + print(response.url) + print(response.text) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor is "{requestor_id}" with role as "{requestor_role}" to create a new event with following details like "{name}" "{category}" "{host_entity_id}" for a period "{From}" till "{To}" for a venue in "{street}" "{building}" "{area}" with "{lat}" "{long}"'), target_fixture='unit_post_request') +def unit_post_request(requestor_id, requestor_role, name, category, host_entity_id, From, To, street, building, area, lat, long ): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'details[name]': name, 'details[category]': category, 'details[host_entity_id]': host_entity_id, 'details[From]': From, 'details[To]': To, 'details[venue][street]': street, 'details[venue][building]': building, 'details[venue][area]': area,'details[venue][lat]': lat, 'details[venue][long]': long} + response = requests.post(API_HOME, data = data) + print(data) + print(response.url) + print(response.text) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor is "{requestor_id}" with role as "{requestor_role}" to create a new event with following details like "{name}" "{category}" "{host_entity_id}" for a period "{From}" till "{To}" for a venue in "{street}" "{building}" "{area}" with "{lat}" "{long}"'), target_fixture='neg_post_request') +def neg_post_request(requestor_id, requestor_role, name, category, host_entity_id, From, To, street, building, area, lat, long): + + data = {'requestor_id': requestor_id,'requestor_role': requestor_role, 'details[name]': name, 'details[category]': category, 'details[host_entity_id]': host_entity_id, 'details[From]': From, 'details[To]': To, 'details[venue][street]': street, 'details[venue][building]': building, 'details[venue][area]': area,'details[venue][lat]': lat, 'details[venue][long]': long} + response = requests.post(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + + +@then(parsers.parse('the result should return event details as "{event_name}" "{event_id}" for requested event')) +def unit_response_assert(unit_post_request, event_name, event_id): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_response = unit_post_request.json() + print(assert_response) + print(type(assert_response.split(",", 1))) + print(assert_response.split(",", 1)[1]) + print(event_id) + assert event_id == event_id + +@when(parsers.parse('a POST request for an endpoint /event/new is triggered to create new event for scheduler block'), target_fixture = 'post_request') +def post_request(): + pass + +@then(parsers.parse('response code of POST request is "{code:d}" for smoke testing')) +def smoke_post_response_code(smoke_post_request, code): + assert smoke_post_request.status_code == code + +@then(parsers.parse('response code of POST request is "{code:d}"')) +def unit_post_response_code(unit_post_request, code): + assert unit_post_request.status_code == code + + +@then(parsers.parse('response code of negative testing POST request for error is "{status_code:d}"')) +def neg_post_response_code(neg_post_request, status_code): + assert neg_post_request.status_code != status_code diff --git a/test/step_deps/test_create_log_new.py b/test/step_deps/test_create_log_new.py new file mode 100644 index 0000000..6116a8c --- /dev/null +++ b/test/step_deps/test_create_log_new.py @@ -0,0 +1,93 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +#API_HOME = 'http://myapi:3000/entity/create_entity/' +API_HOME = 'http://myapi:3000/log/new' + +# Scenarios + +scenarios('../features/createlognew.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor Id is "{healthngo1}" with role as "{healthworker}" to create a new log'), target_fixture='smoke_post_request') +def smoke_post_request(healthngo1,healthworker): + data = {'requestor_id': healthngo1, 'requestor_role': healthworker} + response = requests.post(API_HOME, data = data) + print(response.url) + print(response.text) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor id is "{requestor_id}" with role as "{requestor_role}" to create a log for role "{logger_role}" with its Id "{logger_id}" "{entity_id}" for category "{log_category}" from time period of "{datetime}" with data as "{log_data}"'), target_fixture='unit_post_request') +def unit_post_request(requestor_id, requestor_role, logger_role, logger_id, entity_id, log_category, datetime, log_data): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'log_details[logger_role]': logger_role, 'log_details[logger_id]': logger_id, 'log_details[entity_id]': entity_id, 'log_details[log_category]':log_category,'log_details[datetime]':datetime,'log_details[log_data]':log_data } + response = requests.post(API_HOME, data = data) + print(data) + print(response.url) + print(response.text) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor id is "{requestor_id}" with role as "{requestor_role}" to create a log for role "{logger_role}" with its Id "{logger_id}" "{entity_id}" for category "{log_category}" from time period of "{datetime}" with data as "{log_data}"'), target_fixture='neg_post_request') +def neg_post_request(requestor_id, requestor_role, logger_role, logger_id, entity_id, log_category, datetime, log_data): + + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'log_details[logger_role]': logger_role, 'log_details[logger_id]': logger_id, 'log_details[entity_id]': entity_id, 'log_details[log_category]':log_category,'log_details[datetime]':datetime,'log_details[log_data]':log_data} + response = requests.post(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + + +@then(parsers.parse('the result should return log Id as "{log_id:d}" for smoke testing')) +def unit_response_assert(smoke_post_request,log_id): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_response = smoke_post_request.json() + print(assert_response) + print(type(assert_response.split(",", 1))) + print(assert_response.split(",", 1)[1]) + print(log_id) + assert log_id == log_id + +@then(parsers.parse('the result should return log details like "{log_name}" and "{log_id}" for requested log')) +def unit_response_assert(unit_post_request, log_name, log_id): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_response = unit_post_request.json() + print(assert_response) + print(type(assert_response.split(",", 1))) + print(assert_response.split(",", 1)[1]) + print(log_id) + assert log_id == log_id + +@when(parsers.parse('a POST request for an endpoint /log/new/ is triggered to create new log for scheduler block'), target_fixture = 'post_request') +def post_request(): + pass + +@then(parsers.parse('response code of POST request is "{code:d}" for smoke testing')) +def smoke_post_response_code(smoke_post_request, code): + assert smoke_post_request.status_code == code + +@then(parsers.parse('response code of POST request is "{code:d}"')) +def unit_post_response_code(unit_post_request, code): + assert unit_post_request.status_code == code + + +@then(parsers.parse('response code of negative testing POST request for invalid data is "{status_code:d}"')) +def neg_post_response_code(neg_post_request, status_code): + assert neg_post_request.status_code != status_code diff --git a/test/step_deps/test_create_message_new.py b/test/step_deps/test_create_message_new.py new file mode 100644 index 0000000..2e45c85 --- /dev/null +++ b/test/step_deps/test_create_message_new.py @@ -0,0 +1,93 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +#API_HOME = 'http://myapi:3000/entity/create_entity/' +API_HOME = 'http://myapi:3000/message/new' + +# Scenarios + +scenarios('../features/createmessagenew.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor Id is "{healthngo1}" with role as "{healthworker}" to create a new message'), target_fixture='smoke_post_request') +def smoke_post_request(healthngo1,healthworker): + data = {'requestor_id': healthngo1, 'requestor_role': healthworker} + response = requests.post(API_HOME, data = data) + print(response.url) + print(response.text) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor id is "{requestor_id}" with role as "{requestor_role}" to create a message with details like "{entity_id}" "{category}" with message body as "{message_body}"'), target_fixture='unit_post_request') +def unit_post_request(requestor_id, requestor_role, entity_id, category, message_body): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'message_details[entity_id]': entity_id, 'message_details[category]': category, 'message_details[message_body]': message_body} + response = requests.post(API_HOME, data = data) + print(data) + print(response.url) + print(response.text) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor id is "{requestor_id}" with role as "{requestor_role}" to create a message with details like "{entity_id}" "{category}" with message body as "{message_body}"'), target_fixture='neg_post_request') +def neg_post_request(requestor_id, requestor_role, entity_id, category, message_body): + + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'message_details[entity_id]': entity_id, 'message_details[category]': category, 'message_details[message_body]': message_body} + response = requests.post(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + + +@then(parsers.parse('the result should return message Id as "{message_id:d}" for smoke testing')) +def unit_response_assert(smoke_post_request,message_id): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_response = smoke_post_request.json() + print(assert_response) + print(type(assert_response.split(",", 1))) + print(assert_response.split(",", 1)[1]) + print(message_id) + assert message_id == message_id + +@then(parsers.parse('the result should return message details like "{message_name}" and "{message_id}" for requested message')) +def unit_response_assert(unit_post_request, message_name, message_id): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_response = unit_post_request.json() + print(assert_response) + print(type(assert_response.split(",", 1))) + print(assert_response.split(",", 1)[1]) + print(message_id) + assert message_id == message_id + +@when(parsers.parse('a POST request for an endpoint /message/new/ is triggered to create new message for scheduler block'), target_fixture = 'post_request') +def post_request(): + pass + +@then(parsers.parse('response code of POST request is "{code:d}" for smoke testing')) +def smoke_post_response_code(smoke_post_request, code): + assert smoke_post_request.status_code == code + +@then(parsers.parse('response code of POST request is "{code:d}"')) +def unit_post_response_code(unit_post_request, code): + assert unit_post_request.status_code == code + + +@then(parsers.parse('response code of negative testing POST request for invalid data is "{status_code:d}"')) +def neg_post_response_code(neg_post_request, status_code): + assert neg_post_request.status_code != status_code diff --git a/test/step_deps/test_create_resource_new.py b/test/step_deps/test_create_resource_new.py new file mode 100644 index 0000000..d0819bd --- /dev/null +++ b/test/step_deps/test_create_resource_new.py @@ -0,0 +1,93 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +#API_HOME = 'http://myapi:3000/entity/create_entity/' +API_HOME = 'http://myapi:3000/resource/new' + +# Scenarios + +scenarios('../features/createresourcenew.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor Id is "{healthngo1}" with role as "{healthworker}" to create a new resource'), target_fixture='smoke_post_request') +def smoke_post_request(healthngo1,healthworker): + data = {'requestor_id': healthngo1, 'requestor_role': healthworker} + response = requests.post(API_HOME, data = data) + print(response.url) + print(response.text) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor id is "{requestor_id}" with role as "{requestor_role}" to create a resource with name "{name}" for "{category}" with following details like "{phone}" "{email}" with "{alert_url}" "{alert_preference}" and "{status_poll_url}"'), target_fixture='unit_post_request') +def unit_post_request(requestor_id, requestor_role, name, category, phone, email, alert_url,alert_preference,status_poll_url): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'resource_details[name]': name, 'resource_details[category]': category, 'resource_details[phone]': phone, 'resource_details[email]': email, 'resource_details[alert_url]':alert_url, 'resource_details[alert_preference]': alert_preference, 'resource_details[status_poll_url]': status_poll_url} + response = requests.post(API_HOME, data = data) + print(data) + print(response.url) + print(response.text) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor id is "{requestor_id}" with role as "{requestor_role}" to create a resource with name "{name}" for "{category}" with following details like "{phone}" "{email}" with "{alert_url}" "{alert_preference}" and "{status_poll_url}"'), target_fixture='neg_post_request') +def neg_post_request(requestor_id, requestor_role, name, category, phone, email, alert_url,alert_preference,status_poll_url): + + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'resource_details[name]': name, 'resource_details[category]': category, 'resource_details[phone]': phone, 'resource_details[email]': email, 'resource_details[alert_url]':alert_url, 'resource_details[alert_preference]': alert_preference, 'resource_details[status_poll_url]': status_poll_url} + response = requests.post(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + + +@then(parsers.parse('the result should return resource Id as "{resource_id:d}" for smoke testing')) +def unit_response_assert(smoke_post_request,resource_id): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_response = smoke_post_request.json() + print(assert_response) + print(type(assert_response.split(",", 1))) + print(assert_response.split(",", 1)[1]) + print(resource_id) + assert resource_id == resource_id + +@then(parsers.parse('the result should return resource details like "{resource_id}" and "{resource_name}" for requested resource')) +def unit_response_assert(unit_post_request, resource_name, resource_id): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_response = unit_post_request.json() + print(assert_response) + print(type(assert_response.split(",", 1))) + print(assert_response.split(",", 1)[1]) + print(resource_id) + assert resource_id == resource_id + +@when(parsers.parse('a POST request for an endpoint /resource/new/ is triggered to create new resource for scheduler block'), target_fixture = 'post_request') +def post_request(): + pass + +@then(parsers.parse('response code of POST request is "{code:d}" for smoke testing')) +def smoke_post_response_code(smoke_post_request, code): + assert smoke_post_request.status_code == code + +@then(parsers.parse('response code of POST request is "{code:d}"')) +def unit_post_response_code(unit_post_request, code): + assert unit_post_request.status_code == code + + +@then(parsers.parse('response code of negative testing POST request for invalid data is "{status_code:d}"')) +def neg_post_response_code(neg_post_request, status_code): + assert neg_post_request.status_code != status_code diff --git a/test/step_deps/test_create_subscriber_new.py b/test/step_deps/test_create_subscriber_new.py new file mode 100644 index 0000000..94682e8 --- /dev/null +++ b/test/step_deps/test_create_subscriber_new.py @@ -0,0 +1,93 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +#API_HOME = 'http://myapi:3000/entity/create_entity/' +API_HOME = 'http://myapi:3000/subscriber/new' + +# Scenarios + +scenarios('../features/createsubscribernew.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor Id is "{healthngo1}" with role as "{healthworker}" to create a new subscriber'), target_fixture='smoke_post_request') +def smoke_post_request(healthngo1,healthworker): + data = {'requestor_id': healthngo1, 'requestor_role': healthworker} + response = requests.post(API_HOME, data = data) + print(response.url) + print(response.text) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor id is "{requestor_id}" with role as "{requestor_role}" to create a subscriber with name "{name}" for "{category}" with following details like "{phone}" "{email}" with "{alert_url}" having "{alert_preference}" and "{status_poll_url}"'), target_fixture='unit_post_request') +def unit_post_request(requestor_id, requestor_role, name, category, phone, email, alert_url, alert_preference, status_poll_url): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'subscriber_details[name]': name, 'subscriber_details[category]': category, 'subscriber_details[phone]': phone, 'subscriber_details[email]': email, 'subscriber_details[alert_url]': alert_url, 'subscriber_details[alert_prefernce]':alert_preference,'subscriber_details[status_poll_url]':status_poll_url} + response = requests.post(API_HOME, data = data) + print(data) + print(response.url) + print(response.text) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor id is "{requestor_id}" with role as "{requestor_role}" to create a subscriber with name "{name}" for "{category}" with following details like "{phone}" "{email}" with "{alert_url}" having "{alert_preference}" and "{status_poll_url}"'), target_fixture='neg_post_request') +def neg_post_request(requestor_id, requestor_role, name, category, phone, email, alert_url, alert_preference, status_poll_url): + + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'subscriber_details[name]': name, 'subscriber_details[category]': category, 'subscriber_details[phone]': phone, 'subscriber_details[email]': email, 'subscriber_details[alert_url]': alert_url, 'subscriber_details[alert_prefernce]':alert_preference,'subscriber_details[status_poll_url]':status_poll_url} + response = requests.post(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + + +@then(parsers.parse('the result should return subscriber Id as "{subscriber_id:d}" for smoke testing')) +def unit_response_assert(smoke_post_request,subscriber_id): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_response = smoke_post_request.json() + print(assert_response) + print(type(assert_response.split(",", 1))) + print(assert_response.split(",", 1)[1]) + print(subscriber_id) + assert subscriber_id == subscriber_id + +@then(parsers.parse('the result should return subscriber details like "{subscriber_id}" and "{subscriber_name}" for requested subscriber')) +def unit_response_assert(unit_post_request, subscriber_name, subscriber_id): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_response = unit_post_request.json() + print(assert_response) + print(type(assert_response.split(",", 1))) + print(assert_response.split(",", 1)[1]) + print(subscriber_id) + assert subscriber_id == subscriber_id + +@when(parsers.parse('a POST request for an endpoint /subscriber/new/ is triggered to create new subscriber for scheduler block'), target_fixture = 'post_request') +def post_request(): + pass + +@then(parsers.parse('response code of POST request is "{code:d}" for smoke testing')) +def smoke_post_response_code(smoke_post_request, code): + assert smoke_post_request.status_code == code + +@then(parsers.parse('response code of POST request is "{code:d}"')) +def unit_post_response_code(unit_post_request, code): + assert unit_post_request.status_code == code + + +@then(parsers.parse('response code of negative testing POST request for invalid data is "{status_code:d}"')) +def neg_post_response_code(neg_post_request, status_code): + assert neg_post_request.status_code != status_code diff --git a/test/step_deps/test_delete_affiliation_new.py b/test/step_deps/test_delete_affiliation_new.py new file mode 100644 index 0000000..aa7c1f3 --- /dev/null +++ b/test/step_deps/test_delete_affiliation_new.py @@ -0,0 +1,71 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/affiliation/' +#API_HOME = 'http://myapi:3000/session/create_session/' + +# Scenarios + +scenarios('../features/deleteaffiliationnew.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an affiliation_id "{affiliation_id}" for smoke testing'), target_fixture='smoke_post_request') +def smoke_post_request(requestor_id,requestor_role,affiliation_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'affiliation_id':affiliation_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an affiliation with affiliationId "{affiliation_id}"'), target_fixture='unit_post_request') +def unit_post_request(requestor_id, requestor_role, affiliation_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'affiliation_id': affiliation_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an affiliation with affiliationId "{affiliation_id}"'), target_fixture='neg_post_request') +def neg_post_request(requestor_id, requestor_role, affiliation_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'affiliation_id': affiliation_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + #return response + +@when(parsers.parse('a Delete request for an endpoint /affiliation is triggered to delete an affiliation for scheduler block'), target_fixture = 'post_request') +def post_request(): + pass + + +@then(parsers.parse('response code of Delete request is "{code:d}" for smoke testing')) +def smoke_post_response_code(smoke_post_request, code): + assert smoke_post_request.status_code == code + +@then(parsers.parse('response code of Delete request is "{code:d}"')) +def unit_post_response_code(unit_post_request, code): + assert unit_post_request.status_code == code + + +@then(parsers.parse('response code of negative testing Delete request for invalid data is "{status_code:d}"')) +def neg_post_response_code(neg_post_request, status_code): + assert neg_post_request.status_code != status_code + diff --git a/test/step_deps/test_delete_alert_schedule_new.py b/test/step_deps/test_delete_alert_schedule_new.py new file mode 100644 index 0000000..265e4c2 --- /dev/null +++ b/test/step_deps/test_delete_alert_schedule_new.py @@ -0,0 +1,71 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/alert_schedule/' +#API_HOME = 'http://myapi:3000/session/create_session/' + +# Scenarios + +scenarios('../features/deletealertschedulenew.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an alert_schedule_id "{alert_schedule_id:d}" for smoke testing'), target_fixture='smoke_post_request') +def smoke_post_request(requestor_id,requestor_role,alert_schedule_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'alert_schedule_id':alert_schedule_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an alert_schedule with alert_schedule_Id "{alert_schedule_id}"'), target_fixture='unit_post_request') +def unit_post_request(requestor_id, requestor_role, alert_schedule_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'alert_schedule': alert_schedule_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an alert_schedule with alert_schedule_Id "{alert_schedule_id}"'), target_fixture='neg_post_request') +def neg_post_request(requestor_id, requestor_role, alert_schedule_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'alert_schedule_id': alert_schedule_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + #return response + +@when(parsers.parse('a Delete request for an endpoint /alert_schedule is triggered to delete an alert schedule for scheduler block'), target_fixture = 'post_request') +def post_request(): + pass + + +@then(parsers.parse('response code of Delete request is "{code:d}" for smoke testing')) +def smoke_post_response_code(smoke_post_request, code): + assert smoke_post_request.status_code == code + +@then(parsers.parse('response code of Delete request is "{code:d}"')) +def unit_post_response_code(unit_post_request, code): + assert unit_post_request.status_code == code + + +@then(parsers.parse('response code of negative testing Delete request for invalid data is "{status_code:d}"')) +def neg_post_response_code(neg_post_request, status_code): + assert neg_post_request.status_code != status_code + diff --git a/test/step_deps/test_delete_appointment_new.py b/test/step_deps/test_delete_appointment_new.py new file mode 100644 index 0000000..944224f --- /dev/null +++ b/test/step_deps/test_delete_appointment_new.py @@ -0,0 +1,71 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/appointment/' +#API_HOME = 'http://myapi:3000/session/create_session/' + +# Scenarios + +scenarios('../features/deleteappointmentnew.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an appointment_id "{appointment_id}" for smoke testing'), target_fixture='smoke_post_request') +def smoke_post_request(requestor_id,requestor_role,appointment_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'appointment_id':appointment_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an appointment with appointmentId "{appointment_id}"'), target_fixture='unit_post_request') +def unit_post_request(requestor_id, requestor_role, appointment_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'appointment_id': appointment_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an appointment with appointmentId "{appointment_id}"'), target_fixture='neg_post_request') +def neg_post_request(requestor_id, requestor_role, appointment_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'appointment_id': appointment_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + #return response + +@when(parsers.parse('a Delete request for an endpoint /appointment is triggered to delete an appointment for scheduler block'), target_fixture = 'post_request') +def post_request(): + pass + + +@then(parsers.parse('response code of Delete request is "{code:d}" for smoke testing')) +def smoke_post_response_code(smoke_post_request, code): + assert smoke_post_request.status_code == code + +@then(parsers.parse('response code of Delete request is "{code:d}"')) +def unit_post_response_code(unit_post_request, code): + assert unit_post_request.status_code == code + + +@then(parsers.parse('response code of negative testing Delete request for invalid data is "{status_code:d}"')) +def neg_post_response_code(neg_post_request, status_code): + assert neg_post_request.status_code != status_code + diff --git a/test/step_deps/test_delete_entity_new.py b/test/step_deps/test_delete_entity_new.py new file mode 100644 index 0000000..374aec6 --- /dev/null +++ b/test/step_deps/test_delete_entity_new.py @@ -0,0 +1,71 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/entity/' +#API_HOME = 'http://myapi:3000/session/create_session/' + +# Scenarios + +scenarios('../features/deleteentity.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an entity_id "{entity_id}" for smoke testing'), target_fixture='smoke_post_request') +def smoke_post_request(requestor_id,requestor_role,entity_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'entity_id':entity_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an entity with entityId "{entity_id}"'), target_fixture='unit_post_request') +def unit_post_request(requestor_id, requestor_role, entity_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'entity_id': entity_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an entity with entityId "{entity_id}"'), target_fixture='neg_post_request') +def neg_post_request(requestor_id, requestor_role, entity_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'entity_id': entity_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + #return response + +@when(parsers.parse('a Delete request for an endpoint /entity is triggered to delete an entity for scheduler block'), target_fixture = 'post_request') +def post_request(): + pass + + +@then(parsers.parse('response code of Delete request is "{code:d}" for smoke testing')) +def smoke_post_response_code(smoke_post_request, code): + assert smoke_post_request.status_code == code + +@then(parsers.parse('response code of Delete request is "{code:d}"')) +def unit_post_response_code(unit_post_request, code): + assert unit_post_request.status_code == code + + +@then(parsers.parse('response code of negative testing Delete request for invalid data is "{status_code:d}"')) +def neg_post_response_code(neg_post_request, status_code): + assert neg_post_request.status_code != status_code + diff --git a/test/step_deps/test_delete_event_new.py b/test/step_deps/test_delete_event_new.py new file mode 100644 index 0000000..7fdcfa4 --- /dev/null +++ b/test/step_deps/test_delete_event_new.py @@ -0,0 +1,71 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/event/' +#API_HOME = 'http://myapi:3000/session/create_session/' + +# Scenarios + +scenarios('../features/deleteevent.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an event_id "{event_id}" for smoke testing'), target_fixture='smoke_post_request') +def smoke_post_request(requestor_id,requestor_role,event_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'event_id':event_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an event with eventId "{event_id}"'), target_fixture='unit_post_request') +def unit_post_request(requestor_id, requestor_role, event_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'event_id': event_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an event with eventId "{event_id}"'), target_fixture='neg_post_request') +def neg_post_request(requestor_id, requestor_role, event_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'event_id': event_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + #return response + +@when(parsers.parse('a Delete request for an endpoint /event is triggered to delete an event for scheduler block'), target_fixture = 'post_request') +def post_request(): + pass + + +@then(parsers.parse('response code of Delete request is "{code:d}" for smoke testing')) +def smoke_post_response_code(smoke_post_request, code): + assert smoke_post_request.status_code == code + +@then(parsers.parse('response code of Delete request is "{code:d}"')) +def unit_post_response_code(unit_post_request, code): + assert unit_post_request.status_code == code + + +@then(parsers.parse('response code of negative testing Delete request for invalid data is "{status_code:d}"')) +def neg_post_response_code(neg_post_request, status_code): + assert neg_post_request.status_code != status_code + diff --git a/test/step_deps/test_delete_log_new.py b/test/step_deps/test_delete_log_new.py new file mode 100644 index 0000000..22b0382 --- /dev/null +++ b/test/step_deps/test_delete_log_new.py @@ -0,0 +1,71 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/log/' +#API_HOME = 'http://myapi:3000/session/create_session/' + +# Scenarios + +scenarios('../features/deletelognew.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for a log_id "{log_id}" for smoke testing'), target_fixture='smoke_post_request') +def smoke_post_request(requestor_id,requestor_role,log_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'log_id':log_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for a log_id "{log_id}"'), target_fixture='unit_post_request') +def unit_post_request(requestor_id,requestor_role,log_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'log_id':log_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor Id is "{requestor_id}" with role as "{requestor_role}" for a log_id "{log_id}"'), target_fixture='neg_post_request') +def neg_post_request(requestor_id,requestor_role,log_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'log_id':log_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + #return response + +@when(parsers.parse('a Delete request for an endpoint /log is triggered to delete a log for scheduler block'), target_fixture = 'post_request') +def post_request(): + pass + + +@then(parsers.parse('response code of Delete request is "{code:d}" for smoke testing')) +def smoke_post_response_code(smoke_post_request, code): + assert smoke_post_request.status_code == code + +@then(parsers.parse('response code of Delete request is "{code:d}"')) +def unit_post_response_code(unit_post_request, code): + assert unit_post_request.status_code == code + + +@then(parsers.parse('response code of negative testing Delete request for invalid data is "{status_code:d}"')) +def neg_post_response_code(neg_post_request, status_code): + assert neg_post_request.status_code != status_code + diff --git a/test/step_deps/test_delete_message_new.py b/test/step_deps/test_delete_message_new.py new file mode 100644 index 0000000..b9db7fe --- /dev/null +++ b/test/step_deps/test_delete_message_new.py @@ -0,0 +1,71 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/message/' +#API_HOME = 'http://myapi:3000/session/create_session/' + +# Scenarios + +scenarios('../features/deletemessagenew.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for a message_id "{message_id}" for smoke testing'), target_fixture='smoke_post_request') +def smoke_post_request(requestor_id,requestor_role,message_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'message_id':message_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for a message_id "{message_id}"'), target_fixture='unit_post_request') +def unit_post_request(requestor_id,requestor_role,message_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'message_id':message_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor Id is "{requestor_id}" with role as "{requestor_role}" for a message_id "{message_id}"'), target_fixture='neg_post_request') +def neg_post_request(requestor_id,requestor_role,message_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'message_id':message_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + #return response + +@when(parsers.parse('a Delete request for an endpoint /message is triggered to delete a message for scheduler block'), target_fixture = 'post_request') +def post_request(): + pass + + +@then(parsers.parse('response code of Delete request is "{code:d}" for smoke testing')) +def smoke_post_response_code(smoke_post_request, code): + assert smoke_post_request.status_code == code + +@then(parsers.parse('response code of Delete request is "{code:d}"')) +def unit_post_response_code(unit_post_request, code): + assert unit_post_request.status_code == code + + +@then(parsers.parse('response code of negative testing Delete request for invalid data is "{status_code:d}"')) +def neg_post_response_code(neg_post_request, status_code): + assert neg_post_request.status_code != status_code + diff --git a/test/step_deps/test_delete_resource_new.py b/test/step_deps/test_delete_resource_new.py new file mode 100644 index 0000000..2f82c07 --- /dev/null +++ b/test/step_deps/test_delete_resource_new.py @@ -0,0 +1,71 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/resource/' +#API_HOME = 'http://myapi:3000/session/create_session/' + +# Scenarios + +scenarios('../features/deleteresourcenew.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for a resource_id "{resource_id}" for smoke testing'), target_fixture='smoke_post_request') +def smoke_post_request(requestor_id,requestor_role,resource_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'resource_id':resource_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for a resource_id "{resource_id}"'), target_fixture='unit_post_request') +def unit_post_request(requestor_id,requestor_role,resource_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'resource_id':resource_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor Id is "{requestor_id}" with role as "{requestor_role}" for a resource_id "{resource_id}"'), target_fixture='neg_post_request') +def neg_post_request(requestor_id,requestor_role,resource_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'resource_id':resource_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + #return response + +@when(parsers.parse('a Delete request for an endpoint /resource is triggered to delete a resource for scheduler block'), target_fixture = 'post_request') +def post_request(): + pass + + +@then(parsers.parse('response code of Delete request is "{code:d}" for smoke testing')) +def smoke_post_response_code(smoke_post_request, code): + assert smoke_post_request.status_code == code + +@then(parsers.parse('response code of Delete request is "{code:d}"')) +def unit_post_response_code(unit_post_request, code): + assert unit_post_request.status_code == code + + +@then(parsers.parse('response code of negative testing Delete request for invalid data is "{status_code:d}"')) +def neg_post_response_code(neg_post_request, status_code): + assert neg_post_request.status_code != status_code + diff --git a/test/step_deps/test_delete_subscriber_new.py b/test/step_deps/test_delete_subscriber_new.py new file mode 100644 index 0000000..1fbab8c --- /dev/null +++ b/test/step_deps/test_delete_subscriber_new.py @@ -0,0 +1,71 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/subscriber/' +#API_HOME = 'http://myapi:3000/session/create_session/' + +# Scenarios + +scenarios('../features/deletesubscribernew.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an subscriber_id "{subscriber_id}" for smoke testing'), target_fixture='smoke_post_request') +def smoke_post_request(requestor_id,requestor_role,subscriber_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'subscriber_id':subscriber_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for a subscriber with subscriberId "{subscriber_id}"'), target_fixture='unit_post_request') +def unit_post_request(requestor_id, requestor_role, subscriber_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'subscriber_id': subscriber_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor Id is "{requestor_id}" with role as "{requestor_role}" for a subscriber with subscriberId "{subscriber_id}"'), target_fixture='neg_post_request') +def neg_post_request(requestor_id, requestor_role, subscriber_id): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'subscriber_id': subscriber_id} + response = requests.delete(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + #return response + +@when(parsers.parse('a Delete request for an endpoint /subscriber is triggered to delete a subscriber for scheduler block'), target_fixture = 'post_request') +def post_request(): + pass + + +@then(parsers.parse('response code of Delete request is "{code:d}" for smoke testing')) +def smoke_post_response_code(smoke_post_request, code): + assert smoke_post_request.status_code == code + +@then(parsers.parse('response code of Delete request is "{code:d}"')) +def unit_post_response_code(unit_post_request, code): + assert unit_post_request.status_code == code + + +@then(parsers.parse('response code of negative testing Delete request for invalid data is "{status_code:d}"')) +def neg_post_response_code(neg_post_request, status_code): + assert neg_post_request.status_code != status_code + diff --git a/test/step_deps/test_get_affiliation_list_new.py b/test/step_deps/test_get_affiliation_list_new.py new file mode 100644 index 0000000..2d69968 --- /dev/null +++ b/test/step_deps/test_get_affiliation_list_new.py @@ -0,0 +1,88 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/affiliation/list_details/' + +# Scenarios + +scenarios('../features/getaffiliationlistnew.feature') + +# Fixtures + + + +@pytest.fixture + + +#@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an affiliation_id "{affiliation_id}" for smoke testing'), target_fixture = 'smoke_get_request') +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an affiliation_id "{affiliation_id}" for smoke testing'),target_fixture = 'smoke_get_request') +def smoke_get_request(requestor_id, requestor_role,affiliation_id ): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'affiliation_id': affiliation_id} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + #assert find_free_subscribers_response_code.status_code == code + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for a affiliation_id "{affiliation_id}" with details filter for "{filter_affiliation_id}" and requesting for affiliation details for "{required_category}" "{required_affiliation_id}" "{required_entity_id}" "{required_From}" and "{required_To}"'), target_fixture = 'unit_get_request') +def unit_get_request(requestor_id, requestor_role, affiliation_id, filter_affiliation_id, required_category, required_affiliation_id, required_entity_id, required_From, required_To): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'affiliation_id': affiliation_id, 'affiliation_filter[affiliation_id]': filter_affiliation_id, 'affiliation_details_required[category]': required_category,'affiliation_details_required[affiliation_id]': required_affiliation_id,'affiliation_details_required[entity_id]': required_entity_id,'affiliation_details_required[From]': required_From, 'affiliation_details_required[To]':required_To} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + + +@given(parsers.parse('the invalid inputs for the requestor Id is "{requestor_id}" with role as "{requestor_role}" for a affiliation_id "{affiliation_id}" with details filter for "{filter_affiliation_id}" and requesting for affiliation details for "{required_category}" "{required_affiliation_id}" "{required_entity_id}" "{required_From}" and "{required_To}"'), target_fixture = 'neg_get_request') +def neg_get_request(requestor_id, requestor_role, affiliation_id, filter_affiliation_id, required_category, required_affiliation_id, required_entity_id, required_From, required_To): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'affiliation_id': affiliation_id, 'affiliation_filter[affiliation_id]': filter_affiliation_id, 'affiliation_details_required[category]': required_category,'affiliation_details_required[affiliation_id]': required_affiliation_id,'affiliation_details_required[entity_id]': required_entity_id,'affiliation_details_required[From]': required_From, 'affiliation_details_required[To]':required_To} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + + +@when(parsers.parse('a GET request for an endpoint /affiliation/list_details/ is triggered to get details of a affiliation list'), target_fixture='get_request') +def get_request(): + pass + + + + +@then(parsers.parse('the result should return following details of entity with its name "{affiliation_id}" "{category}" "{entity_id}" "{From}" and "{To}"')) +def unit_get_response_assert(unit_get_request, affiliation_id, category, entity_id, From, To ): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_respone = [] + assert_response = unit_get_request.json() + print(assert_response) + print(type(assert_response)) + print(assert_response[0][0]['details']['resource_category']) + #print(assert_response[1]) + #for i in range(len(assert_response)): + # print((i, assert_response[i])) + assert assert_response[0][0]['details']['resource_category'] == 'physician' + + +@then(parsers.parse('response code of GET request is "{code:d}" for smoke testing')) +def smoke_get_response_code(smoke_get_request, code): + assert smoke_get_request.status_code == code + +@then(parsers.parse('response code of GET request is "{code:d}"')) +def unit_get_response_code(unit_get_request, code): + assert unit_get_request.status_code == code + + + +@then(parsers.parse('response code of negative testing GET request for invalid data is "{status_code}"')) +def neg_get_response_code(neg_get_request, status_code): + assert neg_get_request.status_code != eval(status_code) + + diff --git a/test/step_deps/test_get_alert_schedule_list_new.py b/test/step_deps/test_get_alert_schedule_list_new.py new file mode 100644 index 0000000..0c74853 --- /dev/null +++ b/test/step_deps/test_get_alert_schedule_list_new.py @@ -0,0 +1,88 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/alert_schedule/list_details/' + +# Scenarios + +scenarios('../features/getalertschedulelistnew.feature') + +# Fixtures + + + +@pytest.fixture + + +#@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an event_id "{event_id}" for smoke testing'), target_fixture = 'smoke_get_request') +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an alert_schedule_id "{alert_schedule_id}" for smoke testing'),target_fixture = 'smoke_get_request') +def smoke_get_request(requestor_id, requestor_role, alert_schedule_id): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'alert_schedule_id': alert_schedule_id} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + #assert find_free_subscribers_response_code.status_code == code + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an alert schedule list with details filter for "{filter_alert_schedule_id}" and requesting for alert schedule details for "{required_target_category}" "{required_entity_id}" "{required_alert_schedule_id}" and "{required_message_id}"'), target_fixture = 'unit_get_request') +def unit_get_request(requestor_id, requestor_role,filter_alert_schedule_id, required_target_category, required_entity_id, required_alert_schedule_id, required_message_id): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'alert_schedule_id': filter_alert_schedule_id, 'alert_schedule_details_required[target_category]': required_target_category,'alert_schedule_details_required[entity_id]': required_entity_id,'alert_schedule_details_required[alert_schedule_id]': required_alert_schedule_id,'alert_schedule_details_required[message_id]': required_message_id} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + + +@given(parsers.parse('the invalid inputs for the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an alert schedule list with details filter for "{filter_alert_schedule_id}" and requesting for alert schedule details for "{required_target_category}" "{required_entity_id}" "{required_alert_schedule_id}" and "{required_message_id}"'), target_fixture = 'neg_get_request') +def neg_get_request(requestor_id, requestor_role,filter_alert_schedule_id, required_target_category, required_entity_id, required_alert_schedule_id, required_message_id): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'alert_schedule_filter[alert_schedule_id]': filter_alert_schedule_id, 'alert_schedule_details_required[target_category]': required_target_category,'alert_schedule_details_required[entity_id]': required_entity_id,'alert_schedule_details_required[alert_schedule_id]': required_alert_schedule_id,'alert_schedule_details_required[message_id]': required_message_id} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + + +@when(parsers.parse('a GET request for an endpoint /alert_schedule/list_details/ is triggered to get details of an alert schedule list'), target_fixture='get_request') +def get_request(): + pass + + + + +@then(parsers.parse('the result should return following details of entity with its name "{entity_id}" "{target_category}" "{alert_schedule_id_id}" and "{message_id}"')) +def unit_get_response_assert(unit_get_request, entity_id, target_category, alert_schedule_id,message_id): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_respone = [] + assert_response = unit_get_request.json() + print(assert_response) + print(type(assert_response)) + print(assert_response[0][0]['details']['target_category']) + #print(assert_response[1]) + #for i in range(len(assert_response)): + # print((i, assert_response[i])) + assert assert_response[0][0]['details']['target_category'] == 'subscriber' + + +@then(parsers.parse('response code of GET request is "{code:d}" for smoke testing')) +def smoke_get_response_code(smoke_get_request, code): + assert smoke_get_request.status_code == code + +@then(parsers.parse('response code of GET request is "{code:d}"')) +def unit_get_response_code(unit_get_request, code): + assert unit_get_request.status_code == code + + + +@then(parsers.parse('response code of negative testing GET request for invalid data is "{status_code}"')) +def neg_get_response_code(neg_get_request, status_code): + assert neg_get_request.status_code != eval(status_code) + + diff --git a/test/step_deps/test_get_appointment_list_new.py b/test/step_deps/test_get_appointment_list_new.py new file mode 100644 index 0000000..5cb0793 --- /dev/null +++ b/test/step_deps/test_get_appointment_list_new.py @@ -0,0 +1,88 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/appointment/list_details/' + +# Scenarios + +scenarios('../features/getappointmentlistnew.feature') + +# Fixtures + + + +@pytest.fixture + + +#@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an appointment_id "{appointment_id}" for smoke testing'), target_fixture = 'smoke_get_request') +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an appointment_id "{appointment_id}" for smoke testing'),target_fixture = 'smoke_get_request') +def smoke_get_request(requestor_id, requestor_role,appointment_id ): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'appointment_id': appointment_id} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + #assert find_free_subscribers_response_code.status_code == code + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an appointment_id "{appointment_id}" with details filter for "{filter_appointment_id}" and requesting for appointment details for "{required_event_type}" "{required_event_id}" "{required_appointment_id}" "{required_participant_type}" "{required_participant_id}" "{required_From}" and "{required_To}"'), target_fixture = 'unit_get_request') +def unit_get_request(requestor_id, requestor_role, appointment_id, filter_appointment_id, required_event_type, required_event_id, required_appointment_id, required_participant_type,required_participant_id, required_From, required_To): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'appointment_id': appointment_id, 'appointment_filter[appointment_id]': filter_appointment_id, 'appointment_details_required[event_type]': required_event_type,'appointment_details_required[event_id]': required_event_id,'appointment_details_required[appointment_id]': required_appointment_id,'appointment_details_required[participant_id]': required_participant_id,'appointment_details_required[participant_type]': required_participant_type,'appointment_details_required[From]': required_From, 'appointment_details_required[To]':required_To} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + + +@given(parsers.parse('the invalid inputs for the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an appointment_id "{appointment_id}" with details filter for "{filter_appointment_id}" and requesting for appointment details for "{required_event_type}" "{required_event_id}" "{required_appointment_id}" "{required_participant_type}" "{required_participant_id}" "{required_From}" and "{required_To}"'), target_fixture = 'neg_get_request') +def neg_get_request(requestor_id, requestor_role, appointment_id, filter_appointment_id, required_event_type, required_event_id, required_appointment_id, required_participant_type,required_participant_id, required_From, required_To): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'appointment_id': appointment_id, 'appointment_filter[appointment_id]': filter_appointment_id, 'appointment_details_required[event_type]': required_event_type,'appointment_details_required[event_id]': required_event_id,'appointment_details_required[appointment_id]': required_appointment_id,'appointment_details_required[participant_id]': required_participant_id,'appointment_details_required[participant_type]': required_participant_type,'appointment_details_required[From]': required_From, 'appointment_details_required[To]':required_To} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + + +@when(parsers.parse('a GET request for an endpoint /appointment/list_details/ is triggered to get details of a appointment list'), target_fixture='get_request') +def get_request(): + pass + + + + +@then(parsers.parse('the result should return following details of entity with its name "{appointment_id}" "{event_type}" "{event_id}" "{participant_type}" "{participant_id}" "{appointment_id}" "{From}" and "{To}"')) +def unit_get_response_assert(unit_get_request, appointment_id, event_id, event_type, participant_id,participant_type, From, To ): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_respone = [] + assert_response = unit_get_request.json() + print(assert_response) + print(type(assert_response)) + print(assert_response[0][0]['details']['participant_type']) + #print(assert_response[1]) + #for i in range(len(assert_response)): + # print((i, assert_response[i])) + assert assert_response[0][0]['details']['participant_type'] == 'subscriber' + + +@then(parsers.parse('response code of GET request is "{code:d}" for smoke testing')) +def smoke_get_response_code(smoke_get_request, code): + assert smoke_get_request.status_code == code + +@then(parsers.parse('response code of GET request is "{code:d}"')) +def unit_get_response_code(unit_get_request, code): + assert unit_get_request.status_code == code + + + +@then(parsers.parse('response code of negative testing GET request for invalid data is "{status_code}"')) +def neg_get_response_code(neg_get_request, status_code): + assert neg_get_request.status_code != eval(status_code) + + diff --git a/test/step_deps/test_get_entity_list_new.py b/test/step_deps/test_get_entity_list_new.py new file mode 100644 index 0000000..f4107a7 --- /dev/null +++ b/test/step_deps/test_get_entity_list_new.py @@ -0,0 +1,88 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/entity/list_details/' + +# Scenarios + +scenarios('../features/getentitylistnew.feature') + +# Fixtures + + + +@pytest.fixture + + +#@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an entity_id "{entity_id}" for smoke testing'), target_fixture = 'smoke_get_request') +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an entity_id "{entity_id}" for smoke testing'),target_fixture = 'smoke_get_request') +def smoke_get_request(requestor_id, requestor_role, entity_id): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'entity_id': entity_id} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + #assert find_free_subscribers_response_code.status_code == code + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an entity_id "{entity_id}" with details filter for "{filter_entity_id}" and requesting for entity details for "{required_category}" "{required_entity_id}" "{required_name}" and "{required_email}"'), target_fixture = 'unit_get_request') +def unit_get_request(requestor_id, requestor_role, entity_id, filter_entity_id, required_category, required_entity_id, required_name, required_email): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'entity_id': entity_id, 'entity_filter[entity_id]': filter_entity_id, 'entity_details_required[category]': required_category,'entity_details_required[entity_id]': required_entity_id,'entity_details_required[name]': required_name,'entity_details_required[emai]': required_email} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + + +@given(parsers.parse('the invalid inputs for the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an entity_id "{entity_id}" with details filter for "{filter_entity_id}" and requesting for entity details for "{required_category}" "{required_entity_id}" "{required_name}" and "{required_email}"'), target_fixture = 'neg_get_request') +def neg_get_request(requestor_id, requestor_role, entity_id, filter_entity_id, required_category, required_entity_id, required_name, required_email): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'entity_id': entity_id, 'entity_filter[entity_id]': filter_entity_id, 'entity_details_required[category]': required_category,'entity_details_required[entity_id]': required_entity_id,'entity_details_required[name]': required_name,'entity_details_required[emai]': required_email} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + + +@when(parsers.parse('a GET request for an endpoint /entity/list_details/ is triggered to get details of an entity list'), target_fixture='get_request') +def get_request(): + pass + + + + +@then(parsers.parse('the result should return following details of entity with its name "{name}" "{category}" "{entity_id}" "{phone}" "{email}" and "{website}"')) +def unit_get_response_assert(unit_get_request, name, category, entity_id,phone, email, website): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_respone = [] + assert_response = unit_get_request.json() + print(assert_response) + print(type(assert_response)) + print(assert_response[0][0]['details']['category']) + #print(assert_response[1]) + #for i in range(len(assert_response)): + # print((i, assert_response[i])) + assert assert_response[0][0]['details']['category'] == 'hospital' + + +@then(parsers.parse('response code of GET request is "{code:d}" for smoke testing')) +def smoke_get_response_code(smoke_get_request, code): + assert smoke_get_request.status_code == code + +@then(parsers.parse('response code of GET request is "{code:d}"')) +def unit_get_response_code(unit_get_request, code): + assert unit_get_request.status_code == code + + + +@then(parsers.parse('response code of negative testing GET request for invalid data is "{status_code}"')) +def neg_get_response_code(neg_get_request, status_code): + assert neg_get_request.status_code != eval(status_code) + + diff --git a/test/step_deps/test_get_event_list_new.py b/test/step_deps/test_get_event_list_new.py new file mode 100644 index 0000000..6ec6e48 --- /dev/null +++ b/test/step_deps/test_get_event_list_new.py @@ -0,0 +1,88 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/event/list_details/' + +# Scenarios + +scenarios('../features/geteventlistnew.feature') + +# Fixtures + + + +@pytest.fixture + + +#@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an event_id "{event_id}" for smoke testing'), target_fixture = 'smoke_get_request') +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an event_id "{event_id}" for smoke testing'),target_fixture = 'smoke_get_request') +def smoke_get_request(requestor_id, requestor_role, event_id): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'event_id': event_id} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + #assert find_free_subscribers_response_code.status_code == code + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an event_id "{event_id}" with details filter for "{filter_event_id}" and requesting for event details for "{required_category}" "{required_host_entity_id}" "{required_name}" and "{required_venue}"'), target_fixture = 'unit_get_request') +def unit_get_request(requestor_id, requestor_role, event_id, filter_event_id, required_category, required_host_entity_id, required_name, required_venue): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'event_id': event_id, 'event_filter[event_id]': filter_event_id, 'event_details_required[category]': required_category,'event_details_required[host_entity_id]': required_host_entity_id,'event_details_required[name]': required_name,'event_details_required[venue]': required_venue} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + + +@given(parsers.parse('the invalid inputs for the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an event_id "{event_id}" with details filter for "{filter_event_id}" and requesting for event details for "{required_category}" "{required_host_entity_id}" "{required_name}" and "{required_venue}"'), target_fixture = 'neg_get_request') +def neg_get_request(requestor_id, requestor_role, event_id, filter_event_id, required_category, required_host_entity_id, required_name, required_venue): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'event_id': event_id, 'event_filter[event_id]': filter_event_id, 'event_details_required[category]': required_category,'event_details_required[host_entity_id]': required_host_entity_id,'event_details_required[name]': required_name,'event_details_required[venue]': required_venue} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + + +@when(parsers.parse('a GET request for an endpoint /event/list_details/ is triggered to get details of an event list'), target_fixture='get_request') +def get_request(): + pass + + + + +@then(parsers.parse('the result should return following details of entity with its name "{name}" "{category}" "{event_id}" "{host_entity_id}" and "{venue}"')) +def unit_get_response_assert(unit_get_request, name, category, event_id,host_entity_id, venue): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_respone = [] + assert_response = unit_get_request.json() + print(assert_response) + print(type(assert_response)) + print(assert_response[0][0]['details']['category']) + #print(assert_response[1]) + #for i in range(len(assert_response)): + # print((i, assert_response[i])) + assert assert_response[0][0]['details']['category'] == 'doctor_consultation' + + +@then(parsers.parse('response code of GET request is "{code:d}" for smoke testing')) +def smoke_get_response_code(smoke_get_request, code): + assert smoke_get_request.status_code == code + +@then(parsers.parse('response code of GET request is "{code:d}"')) +def unit_get_response_code(unit_get_request, code): + assert unit_get_request.status_code == code + + + +@then(parsers.parse('response code of negative testing GET request for invalid data is "{status_code}"')) +def neg_get_response_code(neg_get_request, status_code): + assert neg_get_request.status_code != eval(status_code) + + diff --git a/test/step_deps/test_get_log_list_new.py b/test/step_deps/test_get_log_list_new.py new file mode 100644 index 0000000..40247e8 --- /dev/null +++ b/test/step_deps/test_get_log_list_new.py @@ -0,0 +1,88 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/log/list_details/' + +# Scenarios + +scenarios('../features/getloglistnew.feature') + +# Fixtures + + + +@pytest.fixture + + +#@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an log_id "{log_id}" for smoke testing'), target_fixture = 'smoke_get_request') +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an log_id "{log_id}" for smoke testing'),target_fixture = 'smoke_get_request') +def smoke_get_request(requestor_id, requestor_role,log_id ): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'log_id': log_id} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + #assert find_free_subscribers_response_code.status_code == code + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for a log_id "{log_id}" with details filter for "{filter_log_id}" and requesting for log details for "{required_category}" "{required_log_id}" "{required_entity_id}" "{required_From}" and "{required_To}"'), target_fixture = 'unit_get_request') +def unit_get_request(requestor_id, requestor_role, log_id, filter_log_id, required_category, required_log_id, required_entity_id, required_From, required_To): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'log_id': log_id, 'log_filter[log_id]': filter_log_id, 'log_details_required[category]': required_category,'log_details_required[log_id]': required_log_id,'log_details_required[entity_id]': required_entity_id,'log_details_required[From]': required_From, 'log_details_required[To]':required_To} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + + +@given(parsers.parse('the invalid inputs for the requestor Id is "{requestor_id}" with role as "{requestor_role}" for a log_id "{log_id}" with details filter for "{filter_log_id}" and requesting for log details for "{required_category}" "{required_log_id}" "{required_entity_id}" "{required_From}" and "{required_To}"'), target_fixture = 'neg_get_request') +def neg_get_request(requestor_id, requestor_role, log_id, filter_log_id, required_category, required_log_id, required_entity_id, required_From, required_To): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'log_id': log_id, 'log_filter[log_id]': filter_log_id, 'log_details_required[category]': required_category,'log_details_required[log_id]': required_log_id,'log_details_required[entity_id]': required_entity_id,'log_details_required[From]': required_From, 'log_details_required[To]':required_To} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + + +@when(parsers.parse('a GET request for an endpoint /log/list_details/ is triggered to get details of a log list'), target_fixture='get_request') +def get_request(): + pass + + + + +@then(parsers.parse('the result should return following details of entity with its name "{log_id}" "{category}" "{entity_id}" "{From}" and "{To}"')) +def unit_get_response_assert(unit_get_request, log_id, category, entity_id, From, To ): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_respone = [] + assert_response = unit_get_request.json() + print(assert_response) + print(type(assert_response)) + print(assert_response[0][0]['details']['log_category']) + #print(assert_response[1]) + #for i in range(len(assert_response)): + # print((i, assert_response[i])) + assert assert_response[0][0]['details']['log_category'] == 'attendance' + + +@then(parsers.parse('response code of GET request is "{code:d}" for smoke testing')) +def smoke_get_response_code(smoke_get_request, code): + assert smoke_get_request.status_code == code + +@then(parsers.parse('response code of GET request is "{code:d}"')) +def unit_get_response_code(unit_get_request, code): + assert unit_get_request.status_code == code + + + +@then(parsers.parse('response code of negative testing GET request for invalid data is "{status_code}"')) +def neg_get_response_code(neg_get_request, status_code): + assert neg_get_request.status_code != eval(status_code) + + diff --git a/test/step_deps/test_get_message_list_new.py b/test/step_deps/test_get_message_list_new.py new file mode 100644 index 0000000..be532e4 --- /dev/null +++ b/test/step_deps/test_get_message_list_new.py @@ -0,0 +1,88 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/message/list_details/' + +# Scenarios + +scenarios('../features/getmessagelistnew.feature') + +# Fixtures + + + +@pytest.fixture + + +#@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an message_id "{message_id}" for smoke testing'), target_fixture = 'smoke_get_request') +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an message_id "{message_id}" for smoke testing'),target_fixture = 'smoke_get_request') +def smoke_get_request(requestor_id, requestor_role,message_id ): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'message_id': message_id} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + #assert find_free_subscribers_response_code.status_code == code + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for a message_id "{message_id}" with details filter for "{filter_message_id}" and requesting for message details for "{required_category}" "{required_message_id}" "{required_entity_id}" and "{required_message_body}"'), target_fixture = 'unit_get_request') +def unit_get_request(requestor_id, requestor_role, message_id, filter_message_id, required_category, required_message_id, required_entity_id, required_message_body): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'message_id': message_id, 'message_filter[message_id]': filter_message_id, 'message_details_required[category]': required_category,'message_details_required[message_id]': required_message_id,'message_details_required[entity_id]': required_entity_id,'message_details_required[message_body]': required_message_body} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + + +@given(parsers.parse('the invalid inputs for the requestor Id is "{requestor_id}" with role as "{requestor_role}" for a message_id "{message_id}" with details filter for "{filter_message_id}" and requesting for message details for "{required_category}" "{required_message_id}" "{required_entity_id}" and "{required_message_body}"'), target_fixture = 'neg_get_request') +def neg_get_request(requestor_id, requestor_role, message_id, filter_message_id, required_category, required_message_id, required_entity_id, required_message_body): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'message_id': message_id, 'message_filter[message_id]': filter_message_id, 'message_details_required[category]': required_category,'message_details_required[message_id]': required_message_id,'message_details_required[entity_id]': required_entity_id,'message_details_required[message_body]': required_message_body} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + + +@when(parsers.parse('a GET request for an endpoint /message/list_details/ is triggered to get details of a messages list'), target_fixture='get_request') +def get_request(): + pass + + + + +@then(parsers.parse('the result should return following details of entity with its name "{message_id}" "{category}" "{entity_id}" and "{message_body}"')) +def unit_get_response_assert(unit_get_request, message_id, category, entity_id, message_body ): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_respone = [] + assert_response = unit_get_request.json() + print(assert_response) + print(type(assert_response)) + print(assert_response[0][0]['details']['category']) + #print(assert_response[1]) + #for i in range(len(assert_response)): + # print((i, assert_response[i])) + assert assert_response[0][0]['details']['category'] == 'reminder' + + +@then(parsers.parse('response code of GET request is "{code:d}" for smoke testing')) +def smoke_get_response_code(smoke_get_request, code): + assert smoke_get_request.status_code == code + +@then(parsers.parse('response code of GET request is "{code:d}"')) +def unit_get_response_code(unit_get_request, code): + assert unit_get_request.status_code == code + + + +@then(parsers.parse('response code of negative testing GET request for invalid data is "{status_code}"')) +def neg_get_response_code(neg_get_request, status_code): + assert neg_get_request.status_code != eval(status_code) + + diff --git a/test/step_deps/test_get_resource_availabality_details_new.py b/test/step_deps/test_get_resource_availabality_details_new.py new file mode 100644 index 0000000..9589a28 --- /dev/null +++ b/test/step_deps/test_get_resource_availabality_details_new.py @@ -0,0 +1,88 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/resource/availabality/' + +# Scenarios + +scenarios('../features/getresourceavailabalitydetailsnew.feature') + +# Fixtures + + + +@pytest.fixture + + +#@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an resource_id "{resource_id}" for smoke testing'), target_fixture = 'smoke_get_request') +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an resource_id "{resource_id}" for smoke testing'),target_fixture = 'smoke_get_request') +def smoke_get_request(requestor_id, requestor_role,resource_id ): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'free_resource_filter[resource_id]': resource_id} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + #assert find_free_subscribers_response_code.status_code == code + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an resource_id "{resource_id}" with entity Id "{Entity_id}" for category "{category}" for a date period from "{From}" to "{To}"'), target_fixture = 'unit_get_request') +def unit_get_request(requestor_id, requestor_role, resource_id, Entity_id, category, From, To): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'free_resource_filter[resource_id]': resource_id, 'free_resource_filter[Entity_id]': Entity_id, 'free_resource_filter[category]': category, 'free_resource_filter[From]': From, 'free_resource_filter[To]': To} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + + +@given(parsers.parse('the invalid inputs for the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an resource_id "{resource_id}" with entity Id "{Entity_id}" for category "{category}" for a date period from "{From}" to "{To}"'), target_fixture = 'neg_get_request') +def neg_get_request(requestor_id, requestor_role, resource_id, Entity_id, category, From, To): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'free_resource_filter[resource_id]': resource_id, 'free_resource_filter[Entity_id]': Entity_id, 'free_resource_filter[category]': category, 'free_resource_filter[From]': From, 'free_resource_filter[To]': To} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + + +@when(parsers.parse('a GET request for an endpoint /resource/availabality/ is triggered to get details of a resource availabality list'), target_fixture='get_request') +def get_request(): + pass + + + + +@then(parsers.parse('the result should return following details of entity with its name "{resource_id}" "{resource_name}" and "{free_slots}"')) +def unit_get_response_assert(unit_get_request, resource_id, resource_name, free_slots): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_respone = [] + assert_response = unit_get_request.json() + print(assert_response) + print(type(assert_response)) + print(assert_response[0][0]['free_slots']['category']) + #print(assert_response[1]) + #for i in range(len(assert_response)): + # print((i, assert_response[i])) + assert assert_response[0][0]['details']['category'] == 'doctor' + + +@then(parsers.parse('response code of GET request is "{code:d}" for smoke testing')) +def smoke_get_response_code(smoke_get_request, code): + assert smoke_get_request.status_code == code + +@then(parsers.parse('response code of GET request is "{code:d}"')) +def unit_get_response_code(unit_get_request, code): + assert unit_get_request.status_code == code + + + +@then(parsers.parse('response code of negative testing GET request for invalid data is "{status_code}"')) +def neg_get_response_code(neg_get_request, status_code): + assert neg_get_request.status_code != eval(status_code) + + diff --git a/test/step_deps/test_get_resource_list_new.py b/test/step_deps/test_get_resource_list_new.py new file mode 100644 index 0000000..94184e3 --- /dev/null +++ b/test/step_deps/test_get_resource_list_new.py @@ -0,0 +1,88 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/resource/list_details/' + +# Scenarios + +scenarios('../features/getresourcelistnew.feature') + +# Fixtures + + + +@pytest.fixture + + +#@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an resource_id "{resource_id}" for smoke testing'), target_fixture = 'smoke_get_request') +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an resource_id "{resource_id}" for smoke testing'),target_fixture = 'smoke_get_request') +def smoke_get_request(requestor_id, requestor_role,resource_id ): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'resource_id': resource_id} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + #assert find_free_subscribers_response_code.status_code == code + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an resource_id "{resource_id}" with details filter for "{filter_resource_id}" and requesting for resource details for "{required_category}" "{required_resource_id}" "{required_name}" and "{required_email}"'), target_fixture = 'unit_get_request') +def unit_get_request(requestor_id, requestor_role, resource_id, filter_resource_id, required_category, required_resource_id, required_name, required_email): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'resource_id': resource_id, 'resource_filter[resource_id]': filter_resource_id, 'resource_details_required[category]': required_category,'resource_details_required[resource_id]': required_resource_id,'resource_details_required[name]': required_name,'resource_details_required[email]': required_email} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + + +@given(parsers.parse('the invalid inputs for the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an resource_id "{resource_id}" with details filter for "{filter_resource_id}" and requesting for resource details for "{required_category}" "{required_resource_id}" "{required_name}" and "{required_email}"'), target_fixture = 'neg_get_request') +def neg_get_request(requestor_id, requestor_role, resource_id, filter_resource_id, required_category, required_resource_id, required_name, required_email): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'resource_id': resource_id, 'resource_filter[resource_id]': filter_resource_id, 'resource_details_required[category]': required_category,'resource_details_required[resource_id]': required_resource_id,'resource_details_required[name]': required_name,'resource_details_required[email]': required_email} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + + +@when(parsers.parse('a GET request for an endpoint /resource/list_details/ is triggered to get details of a resources list'), target_fixture='get_request') +def get_request(): + pass + + + + +@then(parsers.parse('the result should return following details of entity with its name "{name}" "{category}" "{resource_id}" "{phone}" and "{email}"')) +def unit_get_response_assert(unit_get_request, name, category, resource_id,phone, email, ): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_respone = [] + assert_response = unit_get_request.json() + print(assert_response) + print(type(assert_response)) + print(assert_response[0][0]['details']['category']) + #print(assert_response[1]) + #for i in range(len(assert_response)): + # print((i, assert_response[i])) + assert assert_response[0][0]['details']['category'] == 'doctor' + + +@then(parsers.parse('response code of GET request is "{code:d}" for smoke testing')) +def smoke_get_response_code(smoke_get_request, code): + assert smoke_get_request.status_code == code + +@then(parsers.parse('response code of GET request is "{code:d}"')) +def unit_get_response_code(unit_get_request, code): + assert unit_get_request.status_code == code + + + +@then(parsers.parse('response code of negative testing GET request for invalid data is "{status_code}"')) +def neg_get_response_code(neg_get_request, status_code): + assert neg_get_request.status_code != eval(status_code) + + diff --git a/test/step_deps/test_get_subscriber_list_new.py b/test/step_deps/test_get_subscriber_list_new.py new file mode 100644 index 0000000..487acdf --- /dev/null +++ b/test/step_deps/test_get_subscriber_list_new.py @@ -0,0 +1,88 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/subscriber/list_details/' + +# Scenarios + +scenarios('../features/getsubscriberlistnew.feature') + +# Fixtures + + + +@pytest.fixture + + +#@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for an subscriber_id "{subscriber_id}" for smoke testing'), target_fixture = 'smoke_get_request') +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for a subscriber_id "{subscriber_id}" for smoke testing'),target_fixture = 'smoke_get_request') +def smoke_get_request(requestor_id, requestor_role,subscriber_id ): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'subscriber_id': subscriber_id} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + #assert find_free_subscribers_response_code.status_code == code + +@given(parsers.parse('the requestor Id is "{requestor_id}" with role as "{requestor_role}" for a subscriber_id "{subscriber_id}" with details filter for "{filter_subscriber_id}" and requesting for subscriber details for "{required_category}" "{required_subscriber_id}" "{required_name}" "{required_phone}" and "{required_email}"'), target_fixture = 'unit_get_request') +def unit_get_request(requestor_id, requestor_role, subscriber_id, filter_subscriber_id, required_subscriber_id,required_category, required_name, required_phone,required_email): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'subscriber_id': subscriber_id, 'subscriber_filter[subscriber_id]': filter_subscriber_id, 'subscriber_details_required[category]': required_category,'subscriber_details_required[subscriber_id]': required_subscriber_id,'subscriber_details_required[name]': required_name,'subscriber_details_required[phone]': required_phone,'subscriber_details_required[email]': required_email} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + + +@given(parsers.parse('the invalid inputs for the requestor Id is "{requestor_id}" with role as "{requestor_role}" for a subscriber_id "{subscriber_id}" with details filter for "{filter_subscriber_id}" and requesting for subscriber details for "{required_category}" "{required_subscriber_id}" "{required_name}" "{required_phone}" and "{required_email}"'), target_fixture = 'neg_get_request') +def neg_get_request(requestor_id, requestor_role, subscriber_id, filter_subscriber_id, required_subscriber_id,required_category, required_name, required_phone,required_email): + params = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'subscriber_id': subscriber_id, 'subscriber_filter[subscriber_id]': filter_subscriber_id, 'subscriber_details_required[category]': required_category,'subscriber_details_required[subscriber_id]': required_subscriber_id,'subscriber_details_required[name]': required_name,'subscriber_details_required[phone]': required_phone,'subscriber_details_required[email]': required_email} + response = requests.get(API_HOME, params = params) + print(response.url) + status_code = response.json() + print(status_code) + return response + + +@when(parsers.parse('a GET request for an endpoint /subscriber/list_details/ is triggered to get details of a subscribers list'), target_fixture='get_request') +def get_request(): + pass + + + + +@then(parsers.parse('the result should return following details of entity with its name "{name}" "{category}" "{resource_id}" "{phone}" and "{email}"')) +def unit_get_response_assert(unit_get_request, name, category, subscriber_id,phone, email, ): + # A more comprehensive test would check 'RelatedTopics' for matching phrases + assert_respone = [] + assert_response = unit_get_request.json() + print(assert_response) + print(type(assert_response)) + print(assert_response[0][0]['details']['category']) + #print(assert_response[1]) + #for i in range(len(assert_response)): + # print((i, assert_response[i])) + assert assert_response[0][0]['details']['category'] == 'patient' + + +@then(parsers.parse('response code of GET request is "{code:d}" for smoke testing')) +def smoke_get_response_code(smoke_get_request, code): + assert smoke_get_request.status_code == code + +@then(parsers.parse('response code of GET request is "{code:d}"')) +def unit_get_response_code(unit_get_request, code): + assert unit_get_request.status_code == code + + + +@then(parsers.parse('response code of negative testing GET request for invalid data is "{status_code}"')) +def neg_get_response_code(neg_get_request, status_code): + assert neg_get_request.status_code != eval(status_code) + + diff --git a/test/step_deps/test_update_affiliation_new.py b/test/step_deps/test_update_affiliation_new.py new file mode 100644 index 0000000..79bb4d6 --- /dev/null +++ b/test/step_deps/test_update_affiliation_new.py @@ -0,0 +1,70 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/affiliation/modifications/' +#API_HOME = 'http://myapi:3000/subscribers/create_session/' + +# Scenarios + +scenarios('../features/updateaffiliationnew.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor id is "{healthngo1}" with role as "{healthworker}" to update an affiliation with its ID "{affiliation_id:d}"'), target_fixture='smoke_put_request') +def smoke_put_request(healthngo1,healthworker,affiliation_id): + data = {'requestor_id': healthngo1, 'requestor_role': healthworker,'affiliation_id':affiliation_id} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor id is "{requestor_id}" with role as "{requestor_role}" for an affiliation with Id "{affiliation_id}" to update an affiliation details like "{resource_id}" "{entity_id}" for resource of category "{resource_category}" for a schedule on "{day_of_week}" from "{start_time}" to "{end_time}"'), target_fixture='unit_put_request') +def unit_put_request(requestor_id, requestor_role,affiliation_id,resource_id, entity_id, resource_category,day_of_week, start_time, end_time): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'affiliation_id': affiliation_id,'details[entity_id]': entity_id, 'details[resource_id]': resource_id, 'details[resource_category]': resource_category, 'details[work_days_hours][day_of_week]': day_of_week, 'details[work_days_hours][start_time]': start_time, 'details[work_days_hours][end_time]':end_time} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor id is "{requestor_id}" with role as "{requestor_role}" for an affiliation with Id "{affiliation_id}" to update an affiliation details like "{resource_id}" "{entity_id}" for resource of category "{resource_category}" for a schedule on "{day_of_week}" from "{start_time}" to "{end_time}"'), target_fixture='neg_put_request') +def neg_put_request(requestor_id, requestor_role,affiliation_id,resource_id, entity_id, resource_category,day_of_week, start_time, end_time): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'affiliation_id': affiliation_id,'details[entity_id]': entity_id, 'details[resource_id]': resource_id, 'details[resource_category]': resource_category, 'details[work_days_hours][day_of_week]': day_of_week, 'details[work_days_hours][start_time]': start_time, 'details[work_days_hours][end_time]':end_time} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + #return response + +@when(parsers.parse('an Update request for an endpoint /affiliation/modifications/ is triggered to update existing affiliation details for scheduler block'), target_fixture = 'post_request') +def put_request(): + pass + + +@then(parsers.parse('response code of Update request is "{code:d}" for smoke testing')) +def smoke_put_response_code(smoke_put_request, code): + assert smoke_put_request.status_code == code + +@then(parsers.parse('response code of Update request is "{code:d}"')) +def unit_put_response_code(unit_put_request, code): + assert unit_put_request.status_code == code + + +@then(parsers.parse('response code of negative testing an Update request for invalid data is "{status_code}"')) +def neg_put_response_code(neg_put_request, status_code): + assert neg_put_request.status_code != eval(status_code) diff --git a/test/step_deps/test_update_alert_schedule_new.py b/test/step_deps/test_update_alert_schedule_new.py new file mode 100644 index 0000000..db18c00 --- /dev/null +++ b/test/step_deps/test_update_alert_schedule_new.py @@ -0,0 +1,70 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/alert_schedule/modifications/' +#API_HOME = 'http://myapi:3000/subscribers/create_session/' + +# Scenarios + +scenarios('../features/updatealertschedulenew.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor id is "{healthngo1}" with role as "{healthworker}" to update an alert schedule with its ID "{alert_schedule_id:d}"'), target_fixture='smoke_put_request') +def smoke_put_request(healthngo1,healthworker,alert_schedule_id): + data = {'requestor_id': healthngo1, 'requestor_role': healthworker,'alert_schedule_id':alert_schedule_id} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor id is "{requestor_id}" with role as "{requestor_role}" for an alert schedule with Id "{alert_schedule_id}" to update an alert with its details like "{event_id}" for "{target_category}" with "{message_id}" within a "{alert_datetime}"'), target_fixture='unit_put_request') +def unit_put_request(requestor_id, requestor_role,alert_schedule_id, event_id,target_category,message_id,alert_datetime): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'alert_schedule_id': alert_schedule_id,'alert_schedule_details[event_id]': event_id, 'alert_schedule_details[target_category]': target_category, 'alert_schedule_details[message_id]': message_id, 'alert_schedule_details[alert_datetime]': alert_datetime} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor id is "{requestor_id}" with role as "{requestor_role}" for an alert schedule with Id "{alert_schedule_id}" to update an alert with its details like "{event_id}" for "{target_category}" with "{message_id}" within a "{alert_datetime}"'), target_fixture='neg_put_request') +def neg_put_request(requestor_id, requestor_role,alert_schedule_id, event_id,target_category,message_id,alert_datetime): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'alert_schedule_id': alert_schedule_id,'alert_schedule_details[event_id]': event_id, 'alert_schedule_details[target_category]': target_category, 'alert_schedule_details[message_id]': message_id, 'alert_schedule_details[alert_datetime]': alert_datetime} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + #return response + +@when(parsers.parse('an Update request for an endpoint /alert_schedule/modifications/ is triggered to update existing alert schedule for scheduler block'), target_fixture = 'post_request') +def put_request(): + pass + + +@then(parsers.parse('response code of Update request is "{code:d}" for smoke testing')) +def smoke_put_response_code(smoke_put_request, code): + assert smoke_put_request.status_code == code + +@then(parsers.parse('response code of Update request is "{code:d}"')) +def unit_put_response_code(unit_put_request, code): + assert unit_put_request.status_code == code + + +@then(parsers.parse('response code of negative testing an Update request for invalid data is "{status_code}"')) +def neg_put_response_code(neg_put_request, status_code): + assert neg_put_request.status_code != eval(status_code) diff --git a/test/step_deps/test_update_appointment_new.py b/test/step_deps/test_update_appointment_new.py new file mode 100644 index 0000000..4421c33 --- /dev/null +++ b/test/step_deps/test_update_appointment_new.py @@ -0,0 +1,70 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/appointment/modifications/' +#API_HOME = 'http://myapi:3000/subscribers/create_session/' + +# Scenarios + +scenarios('../features/updateappointmentnew.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor id is "{healthngo1}" with role as "{healthworker}" to update an appointment details with its ID "{appointment_id:d}"'), target_fixture='smoke_put_request') +def smoke_put_request(healthngo1,healthworker,appointment_id): + data = {'requestor_id': healthngo1, 'requestor_role': healthworker,'appointment_id':appointment_id} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor id is "{requestor_id}" with role as "{requestor_role}" for an appointment with Id "{appointment_id}" to update an appointment with its details like "{entity_id}" and "{entity_type}" for participant of "{participant_type}" "{participant_id}" and "{participant_entity_id}" for a time period "{From}" till "{To}" with deadline "{deadline}"'), target_fixture='unit_put_request') +def unit_put_request(requestor_id, requestor_role, appointment_id,entity_id, entity_type, participant_type, participant_id, participant_entity_id, From, To, deadline): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'appointment_id': appointment_id, 'details[entity_id]': entity_id, 'details[entity_type]': entity_type, 'details[participant_type]': participant_type, 'details[participant_id]': participant_id, 'details[participant_entity_id]': participant_entity_id, 'details[From]':From,'details[To]':To, 'details[deadline]': deadline} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor id is "{requestor_id}" with role as "{requestor_role}" for an appointment with Id "{appointment_id}" to update an appointment with its details like "{entity_id}" and "{entity_type}" for participant of "{participant_type}" "{participant_id}" and "{participant_entity_id}" for a time period "{From}" till "{To}" with deadline "{deadline}"'), target_fixture='neg_put_request') +def neg_put_request(requestor_id, requestor_role, appointment_id,entity_id, entity_type, participant_type, participant_id, participant_entity_id, From, To, deadline): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'appointment_id': appointment_id, 'details[entity_id]': entity_id, 'details[entity_type]': entity_type, 'details[participant_type]': participant_type, 'details[participant_id]': participant_id, 'details[participant_entity_id]': participant_entity_id, 'details[From]':From,'details[To]':To, 'details[deadline]': deadline} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + #return response + +@when(parsers.parse('an Update request for an endpoint /appointment/modifications/ is triggered to update existing appointment details for scheduler block'), target_fixture = 'post_request') +def put_request(): + pass + + +@then(parsers.parse('response code of Update request is "{code:d}" for smoke testing')) +def smoke_put_response_code(smoke_put_request, code): + assert smoke_put_request.status_code == code + +@then(parsers.parse('response code of Update request is "{code:d}"')) +def unit_put_response_code(unit_put_request, code): + assert unit_put_request.status_code == code + + +@then(parsers.parse('response code of negative testing an Update request for invalid data is "{status_code}"')) +def neg_put_response_code(neg_put_request, status_code): + assert neg_put_request.status_code != eval(status_code) diff --git a/test/step_deps/test_update_entity_new.py b/test/step_deps/test_update_entity_new.py new file mode 100644 index 0000000..826b588 --- /dev/null +++ b/test/step_deps/test_update_entity_new.py @@ -0,0 +1,70 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/entity/modifications/' +#API_HOME = 'http://myapi:3000/subscribers/create_session/' + +# Scenarios + +scenarios('../features/updateentitynew.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor id is "{healthngo1}" with role as "{healthworker}" to update an entity with its ID "{entity_id:d}"'), target_fixture='smoke_put_request') +def smoke_put_request(healthngo1,healthworker,entity_id): + data = {'requestor_id': healthngo1, 'requestor_role': healthworker,'entity_id':entity_id} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor id is "{requestor_id}" with role as "{requestor_role}" for an entity with Id "{entity_id}" to update an entity with name "{name}" for "{category}" with following details like "{phone}" "{email}" with "{website}"'), target_fixture='unit_put_request') +def unit_put_request(requestor_id, requestor_role, entity_id, name, category, phone, email,website): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'entity_id': entity_id, 'details[name]': name, 'details[category]': category, 'details[phone]': phone, 'details[email]': email, 'details[website]': website} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor id is "{requestor_id}" with role as "{requestor_role}" for an entity with Id "{entity_id}" to update an entity with name "{name}" for "{category}" with following details like "{phone}" "{email}" with "{website}"'), target_fixture='neg_put_request') +def neg_put_request(requestor_id, requestor_role, entity_id, name, category, phone, email,website): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'entity_id': entity_id, 'details[name]': name, 'details[category]': category, 'details[phone]': phone, 'details[email]': email, 'details[website]': website} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + #return response + +@when(parsers.parse('an Update request for an endpoint /entity/modifications/ is triggered to update existing entity for scheduler block'), target_fixture = 'post_request') +def put_request(): + pass + + +@then(parsers.parse('response code of Update request is "{code:d}" for smoke testing')) +def smoke_put_response_code(smoke_put_request, code): + assert smoke_put_request.status_code == code + +@then(parsers.parse('response code of Update request is "{code:d}"')) +def unit_put_response_code(unit_put_request, code): + assert unit_put_request.status_code == code + + +@then(parsers.parse('response code of negative testing an Update request for invalid data is "{status_code}"')) +def neg_put_response_code(neg_put_request, status_code): + assert neg_put_request.status_code != eval(status_code) diff --git a/test/step_deps/test_update_event_new.py b/test/step_deps/test_update_event_new.py new file mode 100644 index 0000000..a6af161 --- /dev/null +++ b/test/step_deps/test_update_event_new.py @@ -0,0 +1,70 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/event/modifications' +#API_HOME = 'http://myapi:3000/subscribers/create_session/' + +# Scenarios + +scenarios('../features/updateevent.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor id is "{healthngo1}" with role as "{healthworker}" to update an event with its ID "{event_id:d}"'), target_fixture='smoke_put_request') +def smoke_put_request(healthngo1,healthworker,event_id): + data = {'requestor_id': healthngo1, 'requestor_role': healthworker,'event_id':event_id} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor id is "{requestor_id}" with role as "{requestor_role}" for an event with Id "{event_id}" to update an event with name "{name}" "{category}" "{host_entity_id}" for a period "{From}" till "{To}" for a venue in "{street}" "{building}" "{area}" with "{lat}" "{long}"'), target_fixture='unit_put_request') +def unit_put_request(requestor_id, requestor_role, event_id, name, category, host_entity_id, From, To, street, building, area, lat, long): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'event_id': event_id, 'details[name]': name, 'details[category]': category, 'details[host_entity_id]': host_entity_id, 'details[From]': From, 'details[To]': To, 'details[venue][street]': street, 'details[venue][building]': building, 'details[venue][area]': area,'details[venue][lat]': lat, 'details[venue][long]': long} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor id is "{requestor_id}" with role as "{requestor_role}" for an event with Id "{event_id}" to update an event with name "{name}" "{category}" "{host_entity_id}" for a period "{From}" till "{To}" for a venue in "{street}" "{building}" "{area}" with "{lat}" "{long}"'), target_fixture='neg_put_request') +def neg_put_request(requestor_id, requestor_role, event_id, name, category, host_entity_id, From, To, street, building, area, lat, long): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'event_id': event_id, 'details[name]': name, 'details[category]': category, 'details[host_entity_id]': host_entity_id, 'details[From]': From, 'details[To]': To, 'details[venue][street]': street, 'details[venue][building]': building, 'details[venue][area]': area,'details[venue][lat]': lat, 'details[venue][long]': long} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + #return response + +@when(parsers.parse('an Update request for an endpoint /event/modifications/ is triggered to update existing event for scheduler block'), target_fixture = 'post_request') +def put_request(): + pass + + +@then(parsers.parse('response code of Update request is "{code:d}" for smoke testing')) +def smoke_put_response_code(smoke_put_request, code): + assert smoke_put_request.status_code == code + +@then(parsers.parse('response code of Update request is "{code:d}"')) +def unit_put_response_code(unit_put_request, code): + assert unit_put_request.status_code == code + + +@then(parsers.parse('response code of negative testing an Update request for invalid data is "{status_code}"')) +def neg_put_response_code(neg_put_request, status_code): + assert neg_put_request.status_code != eval(status_code) diff --git a/test/step_deps/test_update_log_new.py b/test/step_deps/test_update_log_new.py new file mode 100644 index 0000000..8990bc2 --- /dev/null +++ b/test/step_deps/test_update_log_new.py @@ -0,0 +1,70 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/log/modifications/' +#API_HOME = 'http://myapi:3000/subscribers/create_session/' + +# Scenarios + +scenarios('../features/updatelognew.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor id is "{healthngo1}" with role as "{healthworker}" to update a log with its ID "{log_id:d}"'), target_fixture='smoke_put_request') +def smoke_put_request(healthngo1,healthworker,log_id): + data = {'requestor_id': healthngo1, 'requestor_role': healthworker,'log_id':log_id} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor id is "{requestor_id}" with role as "{requestor_role}" for a log with Id "{log_id}" to update a log details for role "{logger_role}" with its Id "{logger_id}" "{entity_id}" for category "{log_category}" from time period of "{datetime}" with data as "{log_data}"'), target_fixture='unit_put_request') +def unit_put_request(requestor_id, requestor_role, log_id,logger_role, logger_id, entity_id, log_category, datetime, log_data): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'log_id': log_id, 'details[logger_role]': logger_role, 'details[logger_id]': logger_id, 'details[entity_id]': entity_id, 'details[log_category]':log_category,'details[datetime]':datetime,'details[log_data]':log_data} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor id is "{requestor_id}" with role as "{requestor_role}" for a log with Id "{log_id}" to update a log details for role "{logger_role}" with its Id "{logger_id}" "{entity_id}" for category "{log_category}" from time period of "{datetime}" with data as "{log_data}"'), target_fixture='neg_put_request') +def neg_put_request(requestor_id, requestor_role, log_id,logger_role, logger_id, entity_id, log_category, datetime, log_data): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'log_id': log_id, 'details[logger_role]': logger_role, 'details[logger_id]': logger_id, 'details[entity_id]': entity_id, 'details[log_category]':log_category,'details[datetime]':datetime,'details[log_data]':log_data} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + #return response + +@when(parsers.parse('an Update request for an endpoint /log/modifications/ is triggered to update existing log details for scheduler block'), target_fixture = 'post_request') +def put_request(): + pass + + +@then(parsers.parse('response code of Update request is "{code:d}" for smoke testing')) +def smoke_put_response_code(smoke_put_request, code): + assert smoke_put_request.status_code == code + +@then(parsers.parse('response code of Update request is "{code:d}"')) +def unit_put_response_code(unit_put_request, code): + assert unit_put_request.status_code == code + + +@then(parsers.parse('response code of negative testing an Update request for invalid data is "{status_code}"')) +def neg_put_response_code(neg_put_request, status_code): + assert neg_put_request.status_code != eval(status_code) diff --git a/test/step_deps/test_update_message_new.py b/test/step_deps/test_update_message_new.py new file mode 100644 index 0000000..dc81089 --- /dev/null +++ b/test/step_deps/test_update_message_new.py @@ -0,0 +1,70 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/message/modifications/' +#API_HOME = 'http://myapi:3000/subscribers/create_session/' + +# Scenarios + +scenarios('../features/updatemessagenew.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor id is "{healthngo1}" with role as "{healthworker}" to update a message with its ID "{message_id:d}"'), target_fixture='smoke_put_request') +def smoke_put_request(healthngo1,healthworker,message_id): + data = {'requestor_id': healthngo1, 'requestor_role': healthworker,'message_id':message_id} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor id is "{requestor_id}" with role as "{requestor_role}" for a message with Id "{message_id}" to update a message details like "{entity_id}" "{category}" and "{message_body}"'), target_fixture='unit_put_request') +def unit_put_request(requestor_id, requestor_role, message_id, entity_id,category, message_body): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'message_id': message_id,'details[entity_id]': entity_id, 'details[category]': category, 'details[message_body]': message_body} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor id is "{requestor_id}" with role as "{requestor_role}" for a message with Id "{message_id}" to update a message details like "{entity_id}" "{category}" and "{message_body}"'), target_fixture='neg_put_request') +def neg_put_request(requestor_id, requestor_role, message_id, entity_id, category, message_body): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'message_id': message_id,'details[entity_id]': entity_id, 'details[category]': category, 'details[message_body]': message_body} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + #return response + +@when(parsers.parse('an Update request for an endpoint /message/modifications/ is triggered to update existing message details for scheduler block'), target_fixture = 'post_request') +def put_request(): + pass + + +@then(parsers.parse('response code of Update request is "{code:d}" for smoke testing')) +def smoke_put_response_code(smoke_put_request, code): + assert smoke_put_request.status_code == code + +@then(parsers.parse('response code of Update request is "{code:d}"')) +def unit_put_response_code(unit_put_request, code): + assert unit_put_request.status_code == code + + +@then(parsers.parse('response code of negative testing an Update request for invalid data is "{status_code}"')) +def neg_put_response_code(neg_put_request, status_code): + assert neg_put_request.status_code != eval(status_code) diff --git a/test/step_deps/test_update_resource_new.py b/test/step_deps/test_update_resource_new.py new file mode 100644 index 0000000..c391fbc --- /dev/null +++ b/test/step_deps/test_update_resource_new.py @@ -0,0 +1,70 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/resource/modifications/' +#API_HOME = 'http://myapi:3000/subscribers/create_session/' + +# Scenarios + +scenarios('../features/updateresourcenew.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor id is "{healthngo1}" with role as "{healthworker}" to update a resource with its ID "{resource_id:d}"'), target_fixture='smoke_put_request') +def smoke_put_request(healthngo1,healthworker,resource_id): + data = {'requestor_id': healthngo1, 'requestor_role': healthworker,'resource_id':resource_id} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor id is "{requestor_id}" with role as "{requestor_role}" for a resource with Id "{resource_id}" to update a resource details like "{name}" for "{category}" with "{phone}" "{email}" "{alert_url}" "{alert_preference}" and "{status_poll_url}"'), target_fixture='unit_put_request') +def unit_put_request(requestor_id, requestor_role, resource_id, name, category, phone, email, alert_url,alert_preference,status_poll_url): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'requestor_id': requestor_id, 'details[name]': name, 'details[category]': category, 'details[phone]': phone, 'details[email]': email, 'details[alert_url]':alert_url, 'details[alert_preference]': alert_preference, 'details[status_poll_url]': status_poll_url} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor id is "{requestor_id}" with role as "{requestor_role}" for a resource with Id "{resource_id}" to update a resource details like "{name}" for "{category}" with "{phone}" "{email}" "{alert_url}" "{alert_preference}" and "{status_poll_url}"'), target_fixture='neg_put_request') +def neg_put_request(requestor_id, requestor_role, resource_id, name, category, phone, email, alert_url,alert_preference,status_poll_url): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role, 'requestor_id': requestor_id, 'details[name]': name, 'details[category]': category, 'details[phone]': phone, 'details[email]': email, 'details[alert_url]':alert_url, 'details[alert_preference]': alert_preference, 'details[status_poll_url]': status_poll_url} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + #return response + +@when(parsers.parse('an Update request for an endpoint /resource/modifications/ is triggered to update existing resource for scheduler block'), target_fixture = 'post_request') +def put_request(): + pass + + +@then(parsers.parse('response code of Update request is "{code:d}" for smoke testing')) +def smoke_put_response_code(smoke_put_request, code): + assert smoke_put_request.status_code == code + +@then(parsers.parse('response code of Update request is "{code:d}"')) +def unit_put_response_code(unit_put_request, code): + assert unit_put_request.status_code == code + + +@then(parsers.parse('response code of negative testing an Update request for invalid data is "{status_code}"')) +def neg_put_response_code(neg_put_request, status_code): + assert neg_put_request.status_code != eval(status_code) diff --git a/test/step_deps/test_update_subscriber_new.py b/test/step_deps/test_update_subscriber_new.py new file mode 100644 index 0000000..0f70f17 --- /dev/null +++ b/test/step_deps/test_update_subscriber_new.py @@ -0,0 +1,70 @@ +import pytest +import json +import requests +import sys +from pytest_bdd import scenarios, given, when, then, parsers + + +#API_HOME = 'http://172.16.51.57:8000/home/' +API_HOME = 'http://myapi:3000/subscriber/modifications/' +#API_HOME = 'http://myapi:3000/subscribers/create_session/' + +# Scenarios + +scenarios('../features/updatesubscribernew.feature') + +# Fixtures + + + +@pytest.fixture + + + +@given(parsers.parse('the requestor id is "{healthngo1}" with role as "{healthworker}" to update a subscriber details with its ID "{subscriber_id:d}"'), target_fixture='smoke_put_request') +def smoke_put_request(healthngo1,healthworker,subscriber_id): + data = {'requestor_id': healthngo1, 'requestor_role': healthworker,'subscriber_id':subscriber_id} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + +@given(parsers.parse('the requestor id is "{requestor_id}" with role as "{requestor_role}" for a subscriber with Id "{subscriber_id}" to update a subscriber details name "{name}" for "{category}" with following details like "{phone}" "{email}" with "{alert_url}" having "{alert_preference}" and "{status_poll_url}"'), target_fixture='unit_put_request') +def unit_put_request(requestor_id, requestor_role, subscriber_id, name, category, phone, email, alert_url, alert_preference, status_poll_url): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'subscriber_id': subscriber_id, 'details[name]': name, 'details[category]': category, 'details[phone]': phone, 'details[email]': email, 'details[alert_url]': alert_url, 'details[alert_prefernce]':alert_preference,'details[status_poll_url]':status_poll_url} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + +@given(parsers.parse('the invalid inputs for the requestor id is "{requestor_id}" with role as "{requestor_role}" for a subscriber with Id "{subscriber_id}" to update a subscriber details name "{name}" for "{category}" with following details like "{phone}" "{email}" with "{alert_url}" having "{alert_preference}" and "{status_poll_url}"'), target_fixture='neg_put_request') +def neg_put_request(requestor_id, requestor_role, subscriber_id, name, category, phone, email, alert_url, alert_preference, status_poll_url): + data = {'requestor_id': requestor_id, 'requestor_role': requestor_role,'subscriber_id': subscriber_id, 'details[name]': name, 'details[category]': category, 'details[phone]': phone, 'details[email]': email, 'details[alert_url]': alert_url, 'details[alert_prefernce]':alert_preference,'details[status_poll_url]':status_poll_url} + response = requests.put(API_HOME, data = data) + print(response.url) + status_code = response.text + print(status_code) + return response + + #return response + +@when(parsers.parse('an Update request for an endpoint /subscriber/modifications/ is triggered to update existing subscriber details for scheduler block'), target_fixture = 'post_request') +def put_request(): + pass + + +@then(parsers.parse('response code of Update request is "{code:d}" for smoke testing')) +def smoke_put_response_code(smoke_put_request, code): + assert smoke_put_request.status_code == code + +@then(parsers.parse('response code of Update request is "{code:d}"')) +def unit_put_response_code(unit_put_request, code): + assert unit_put_request.status_code == code + + +@then(parsers.parse('response code of negative testing an Update request for invalid data is "{status_code}"')) +def neg_put_response_code(neg_put_request, status_code): + assert neg_put_request.status_code != eval(status_code) diff --git a/test/test-results/result.xml b/test/test-results/result.xml new file mode 100644 index 0000000..3ec353c --- /dev/null +++ b/test/test-results/result.xml @@ -0,0 +1 @@ + \ No newline at end of file