From 9e2990029f51d17a0861cd2bfe1208e9fdd726eb Mon Sep 17 00:00:00 2001 From: roost-io Date: Mon, 18 Mar 2024 05:03:19 +0000 Subject: [PATCH] Integration test generated by RoostGPT Using AI Model roostgpt-4-32k --- .../ArrangeCallForUnpaidOverdueBalance.csv | 11 +++ .../ArrangeCallForUnpaidOverdueBalance.yaml | 80 +++++++++++++++++++ .../FetchCreditCardDueDateAndBalance.csv | 11 +++ .../FetchCreditCardDueDateAndBalance.yaml | 47 +++++++++++ ...pdateCardBalanceAfterPaymentCollection.csv | 11 +++ ...dateCardBalanceAfterPaymentCollection.yaml | 53 ++++++++++++ 6 files changed, 213 insertions(+) create mode 100644 api_tests/ArrangeCallForUnpaidOverdueBalance.csv create mode 100644 api_tests/ArrangeCallForUnpaidOverdueBalance.yaml create mode 100644 api_tests/FetchCreditCardDueDateAndBalance.csv create mode 100644 api_tests/FetchCreditCardDueDateAndBalance.yaml create mode 100644 api_tests/UpdateCardBalanceAfterPaymentCollection.csv create mode 100644 api_tests/UpdateCardBalanceAfterPaymentCollection.yaml diff --git a/api_tests/ArrangeCallForUnpaidOverdueBalance.csv b/api_tests/ArrangeCallForUnpaidOverdueBalance.csv new file mode 100644 index 00000000..e447031b --- /dev/null +++ b/api_tests/ArrangeCallForUnpaidOverdueBalance.csv @@ -0,0 +1,11 @@ +balance,dueDate,contactDetails +500.00,2022-01-11,john@mail.com +1200.00,2022-02-24,jane@mail.com +850.00,2022-03-14,paul@mail.com +3000.00,2022-04-19,lucy@mail.com +1110.00,2022-05-22,kirk@mail.com +4100.00,2022-06-30,julia@mail.com +2900.00,2022-07-17,lisa@mail.com +1500.00,2022-08-09,mark@mail.com +2000.00,2022-09-14,kelly@mail.com +600.00,2022-10-16,clark@mail.com diff --git a/api_tests/ArrangeCallForUnpaidOverdueBalance.yaml b/api_tests/ArrangeCallForUnpaidOverdueBalance.yaml new file mode 100644 index 00000000..c9a395b3 --- /dev/null +++ b/api_tests/ArrangeCallForUnpaidOverdueBalance.yaml @@ -0,0 +1,80 @@ +# ********RoostGPT******** + +# Test generated by RoostGPT for test TDD-based-test using AI Type Azure Open AI and AI Model roostgpt-4-32k +# +# ROOST_METHOD_HASH=bd4a05a554 +# ROOST_METHOD_SIG_HASH=995279140f +# +# ########## Scenario ########## +# +# { +# background: null, +# rule: null, +# scenario: 'Arrange for a call to the user if the balance is unpaid and overdue\n' + +# ' Given there is an Unpaid and Overdue Credit Card balance\n' + +# ' When the client sends a POST request to "/api/creditCard/checkBalance" with the credit card balance, due date, and contact details\n' + +# ' Then the response status code should be 200\n' + +# ' And a call should be arranged to the user', +# title: 'Arrange for a call to the user if the balance is unpaid and overdue' +# } +# + +# ********RoostGPT******** +config: + target: "{{ $processEnvironment.API_HOST }}/creditCard" + processor: "./processor.js" + phases: + - duration: 60 + arrivalRate: 5 + payload: + path: "ArrangeCallForUnpaidOverdueBalance.csv" + fields: + - "balance" + - "dueDate" + - "contactDetails" + skipHeader: true + plugins: + expect: {} + +scenarios: + - name: "Arrange for a call to the user if the balance is unpaid and overdue" + flow: + - get: + url: "/details" + headers: + Authorization: "Bearer {{ $processEnvironment.AUTH_TOKEN }}" + expect: + - statusCode: 200 + # Check if balance and due date are retrieved and not empty + - hasProperty: "body.balance" + - hasProperty: "body.dueDate" + - log: "Fetched credit card due date and balance" + - think: 1 + - post: + url: "/checkBalance" + json: + balance: "{{ balance }}" + dueDate: "{{ dueDate }}" + headers: + Authorization: "Bearer {{ $processEnvironment.AUTH_TOKEN }}" + expect: + - statusCode: 200 + # Ensure call is arranged when balance is unpaid and overdue + - hasProperty: "body.callArranged" + - equals: + body.callArranged: true + - log: "Arranged a call to collect payment if balance is unpaid and overdue." + - think: 1 + - post: + url: "/payment" + headers: + Authorization: "Bearer {{ $processEnvironment.AUTH_TOKEN }}" + expect: + - statusCode: 200 + # Ensure payment is successful and balance is updated + - hasProperty: "body.paymentStatus" + - equals: + body.paymentStatus: "Successful" + - hasProperty: "body.updatedBalance" + - log: "Updated the card balance after successful payment collection." + - think: 1 diff --git a/api_tests/FetchCreditCardDueDateAndBalance.csv b/api_tests/FetchCreditCardDueDateAndBalance.csv new file mode 100644 index 00000000..b483c98d --- /dev/null +++ b/api_tests/FetchCreditCardDueDateAndBalance.csv @@ -0,0 +1,11 @@ +creditCardId +1234567890123456 +2345678901234567 +3456789012345678 +4567890123456789 +5678901234567890 +6789012345678901 +7890123456789012 +8901234567890123 +9012345678901234 +0123456789012345 diff --git a/api_tests/FetchCreditCardDueDateAndBalance.yaml b/api_tests/FetchCreditCardDueDateAndBalance.yaml new file mode 100644 index 00000000..b23a55bb --- /dev/null +++ b/api_tests/FetchCreditCardDueDateAndBalance.yaml @@ -0,0 +1,47 @@ +# ********RoostGPT******** + +# Test generated by RoostGPT for test TDD-based-test using AI Type Azure Open AI and AI Model roostgpt-4-32k +# +# ROOST_METHOD_HASH=f413ede025 +# ROOST_METHOD_SIG_HASH=443c01b3f3 +# +# ########## Scenario ########## +# +# { +# background: null, +# rule: null, +# scenario: 'Fetch the credit card due date and balance for a given credit card\n' + +# ' Given there are valid Credit Card details\n' + +# ' When the client sends a GET request to "/api/creditCard/details" with the credit card details\n' + +# ' Then the response status code should be 200\n' + +# ' And the response should contain the due date and balance', +# title: 'Fetch the credit card due date and balance for a given credit card' +# } +# + +# ********RoostGPT******** +config: + target: "{{ $processEnvironment.API_HOST }}/api" + plugins: + expect: {} + override: + headers: + Authorization: "{{ $processEnvironment.AUTH_TOKEN }}" + payload: + path: "FetchCreditCardDueDateAndBalance.csv" + fields: + - creditCardId + skipHeader: true + +scenarios: + - name: "Fetch the credit card due date and balance for a given credit card" + flow: + # Send a GET request to /creditCard/details endpoint with credit card Id + - get: + url: "/creditCard/details?creditCardId={{ creditCardId }}" + expect: + # Expect the status code to be 200 (OK). + - statusCode: 200 + # Expect the response body to have the "dueDate" and "balance" properties. + - hasProperty: 'dueDate' + - hasProperty: 'balance' diff --git a/api_tests/UpdateCardBalanceAfterPaymentCollection.csv b/api_tests/UpdateCardBalanceAfterPaymentCollection.csv new file mode 100644 index 00000000..356f76ff --- /dev/null +++ b/api_tests/UpdateCardBalanceAfterPaymentCollection.csv @@ -0,0 +1,11 @@ +paymentAmount,creditCardNumber +123.45,4485577834925895 +234.56,4556779485673219 +345.67,4916147892344692 +456.78,4577913450984326 +567.89,4556678947391234 +678.90,4716459721465897 +789.01,4929475748123569 +890.12,4532869872042135 +901.23,4875320145789062 +102.34,4500839428105678 diff --git a/api_tests/UpdateCardBalanceAfterPaymentCollection.yaml b/api_tests/UpdateCardBalanceAfterPaymentCollection.yaml new file mode 100644 index 00000000..33ef3105 --- /dev/null +++ b/api_tests/UpdateCardBalanceAfterPaymentCollection.yaml @@ -0,0 +1,53 @@ +# ********RoostGPT******** + +# Test generated by RoostGPT for test TDD-based-test using AI Type Azure Open AI and AI Model roostgpt-4-32k +# +# ROOST_METHOD_HASH=ee492ced05 +# ROOST_METHOD_SIG_HASH=b21cea14f7 +# +# ########## Scenario ########## +# +# { +# background: null, +# rule: null, +# scenario: 'Update the card balance once payment is collected\n' + +# ' Given the system has started collecting payment and the payment is successful\n' + +# ' When the client sends a POST request to "/api/creditCard/payment" with the payment status\n' + +# ' Then the response status code should be 200\n' + +# ' And the card balance should be updated', +# title: 'Update the card balance once payment is collected' +# } +# + +# ********RoostGPT******** +config: + target: "{{ $processEnvironment.API_HOST }}/api" + phases: + - duration: 60 + - arrivalRate: 2 + payload: + path: "UpdateCardBalanceAfterPaymentCollection.csv" + fields: + - "paymentAmount" + - "creditCardNumber" + environments: + dev: + API_HOST: "{{ $processEnvironment.API_HOST }}" + +scenarios: + - name: "Update the card balance once payment is collected" + flow: + # This script simulates a POST request to the /creditCard/payment endpoint + # with the provided paymentAmount and creditCardNumber + - post: + url: "/creditCard/payment" + json: + paymentAmount: "{{ paymentAmount }}" + creditCardNumber: "{{ creditCardNumber }}" + expect: + # Asserting that the response status code is 200 + - statusCode: 200 + # Asserting that response has the property "balance" + - hasProperty: "balance" + log: "Sent POST request to /creditCard/payment with payment status, received 200 response and balance updated" + - think: 1