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

Test generated by RoostGPT for test dm-integration-test using AI Type Open AI and AI Model gpt-4 #7

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
43 changes: 43 additions & 0 deletions api_tests/Create_a_new_product.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Test generated by RoostGPT for test dm-integration-test using AI Type Open AI and AI Model gpt-4

config:
target: "{{ $processEnvironment.SERVER_URL }}/api"
phases:
- duration: 60
arrivalRate: 20
scenarios:
- name: "Create a new product and verify the product properties"
flow:
# This scenario is to create a new product and verify the product properties
- post:
# Assigning meaningful name to the variables
url: "/products"
headers:
Content-Type: "application/json"
json:
name: "Test Product"
description: "This is a test product."
price: 10.0
# Capture the productId from the response for further use
capture:
json: "$.productId"
as: "productId"
# Assert the response to validate the status code and presence of productId
expect:
- statusCode: 201
- hasProperty: "productId"
- get:
# Use the captured productId to get the details of the created product
url: "/products/{{ productId }}"
# Assert the response to validate the status code and the product properties
expect:
- statusCode: 200
- equals:
- "name"
- "Test Product"
- equals:
- "description"
- "This is a test product."
- equals:
- "price"
- 10.0
37 changes: 37 additions & 0 deletions api_tests/Delete_an_existing_product.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Test generated by RoostGPT for test dm-integration-test using AI Type Open AI and AI Model gpt-4

config:
target: "{{ $processEnvironment.SERVER_URL }}/api"
phases:
- duration: 60
arrivalRate: 20
scenarios:
- name: "Delete an existing product"
flow:
# Scenario: Fetch product details before deletion
- get:
url: "/products/1"
headers:
Content-Type: "application/json"
expect:
# Expecting a successful response with product details
- statusCode: 200
- hasProperty: "name"
- hasProperty: "description"
- hasProperty: "price"
# Scenario: Delete the fetched product
- delete:
url: "/products/1"
headers:
Content-Type: "application/json"
expect:
# Expecting a successful deletion response
- statusCode: 200
# Scenario: Verify if the product is deleted
- get:
url: "/products/1"
headers:
Content-Type: "application/json"
expect:
# Expecting a response indicating that the product does not exist
- statusCode: 404
33 changes: 33 additions & 0 deletions api_tests/Get_a_product_by_ID.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Test generated by RoostGPT for test dm-integration-test using AI Type Open AI and AI Model gpt-4

config:
target: "{{ $processEnvironment.SERVER_URL }}/api"
phases:
- duration: 60
arrivalRate: 20
scenarios:
- name: "Get a product by ID"
comment: "This scenario tests the retrieval of a product by its ID. The expected outcome is a successful response (200) with the product details."
flow:
- get:
url: "/products/1"
headers:
content-type: "application/json"
expect:
- statusCode: 200
- hasProperty: "productId"
- equals:
- "productId"
- 1
- hasProperty: "name"
- hasProperty: "description"
- hasProperty: "price"
- match:
json: "$.name"
regex: ".+"
- match:
json: "$.description"
regex: ".+"
- match:
json: "$.price"
regex: "\d+"
32 changes: 32 additions & 0 deletions api_tests/Get_all_products.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Test generated by RoostGPT for test dm-integration-test using AI Type Open AI and AI Model gpt-4

config:
target: "{{ $processEnvironment.SERVER_URL }}/api"
phases:
- duration: 60
arrivalRate: 20
scenarios:
- name: "Get all products"
flow:
- get:
url: "/products"
headers:
content-type: "application/json"
capture:
- json: "$.products"
as: "products"
expect:
- statusCode: 200
- hasProperty: "products"
- equals:
products: []
- hasProperty: "id"
- hasProperty: "name"
- hasProperty: "description"
- hasProperty: "price"
- equals:
id: 10
name: "apple"
description: "description of the product"
price: 20
# This scenario is testing the GET /products API endpoint. The expected behavior is that the API returns a 200 status code, and the response body contains a "products" property. The "products" property should be an empty array, indicating that there are no products. Additionally, the response body should contain "id", "name", "description", and "price" properties. The values of these properties should match the expected values.
45 changes: 45 additions & 0 deletions api_tests/Update_an_existing_product.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Test generated by RoostGPT for test dm-integration-test using AI Type Open AI and AI Model gpt-4

config:
target: "{{ $processEnvironment.SERVER_URL }}/api"
phases:
- duration: 60
arrivalRate: 20
scenarios:
- name: "Update an existing product"
comment: "This scenario tests the successful update of an existing product with ID 1."
flow:
- post:
url: "/products/1"
headers:
$ref: "#/definitions/headers"
json:
$ref: "#/definitions/productUpdatePayload"
capture:
json: "$.productId"
as: "productId"
expect:
- statusCode: 200
- equals:
- "{{ productId }}"
- "1"
- get:
url: "/products/{{ productId }}"
expect:
- statusCode: 200
- equals:
- "{{ response.body.name }}"
- "Updated Product"
- equals:
- "{{ response.body.description }}"
- "This is an updated test product."
- equals:
- "{{ response.body.price }}"
- 15.0
definitions:
headers:
Content-Type: "application/json"
productUpdatePayload:
name: "Updated Product"
description: "This is an updated test product."
price: 15.0