Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration test generated by RoostGPT #148

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions api_tests/ArrangeCallForUnpaidOverdueBalance.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
balance,dueDate,contactDetails
500.00,2022-01-11,[email protected]
1200.00,2022-02-24,[email protected]
850.00,2022-03-14,[email protected]
3000.00,2022-04-19,[email protected]
1110.00,2022-05-22,[email protected]
4100.00,2022-06-30,[email protected]
2900.00,2022-07-17,[email protected]
1500.00,2022-08-09,[email protected]
2000.00,2022-09-14,[email protected]
600.00,2022-10-16,[email protected]
80 changes: 80 additions & 0 deletions api_tests/ArrangeCallForUnpaidOverdueBalance.yaml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions api_tests/FetchCreditCardDueDateAndBalance.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
creditCardId
1234567890123456
2345678901234567
3456789012345678
4567890123456789
5678901234567890
6789012345678901
7890123456789012
8901234567890123
9012345678901234
0123456789012345
47 changes: 47 additions & 0 deletions api_tests/FetchCreditCardDueDateAndBalance.yaml
Original file line number Diff line number Diff line change
@@ -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'
11 changes: 11 additions & 0 deletions api_tests/UpdateCardBalanceAfterPaymentCollection.csv
Original file line number Diff line number Diff line change
@@ -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
53 changes: 53 additions & 0 deletions api_tests/UpdateCardBalanceAfterPaymentCollection.yaml
Original file line number Diff line number Diff line change
@@ -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