Smoke Test

Test Anatomy

Test File Anatomy

This section explains the key elements of the generated test file, allowing you to quickly make adjustments, if needed.

  • The header of each test file shows when the test was generated and what command was used to generate it.

  • The body of the test file imports all relevant libraries and specifies the URL for all test requests.

  • Each method being tested has a function that consists of:

    • Invocation of Skyramp Client

    • Definition of the authentication header

    • Definition of the request body

    • Formation of the request

    • Assertion against expected status code

Test File Anatomy

This section explains the key elements of the generated test file, allowing you to quickly make adjustments, if needed.

  • The header of each test file shows when the test was generated and what command was used to generate it.

  • The body of the test file imports all relevant libraries and specifies the URL for all test requests.

  • Each method being tested has a function that consists of:

    • Invocation of Skyramp Client

    • Definition of the authentication header

    • Definition of the request body

    • Formation of the request

    • Assertion against expected status code

Test File Anatomy

This section explains the key elements of the generated test file, allowing you to quickly make adjustments, if needed.

  • The header of each test file shows when the test was generated and what command was used to generate it.

  • The body of the test file imports all relevant libraries and specifies the URL for all test requests.

  • Each method being tested has a function that consists of:

    • Invocation of Skyramp Client

    • Definition of the authentication header

    • Definition of the request body

    • Formation of the request

    • Assertion against expected status code

Python

Java

Typescript

Test Anatomy for All Methods of Endpoint

# Generated by Skyramp v1.2.1 on 2025-06-30 00:48:10.763141 -0700 PDT m=+0.912849584
# Command: skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
# 		--api-schema https://demoshop.skyramp.dev/openapi.json \
# 		--framework pytest \
# 		--language python \

# Import of required libraries
import skyramp
import os
import time
# URL for test requests
URL = "https://demoshop.skyramp.dev"

# Definition of authentication header
def get_header():
    headers = {}
    if os.getenv("SKYRAMP_TEST_TOKEN") is not None:
        headers["Authorization"] = "Bearer " + os.getenv("SKYRAMP_TEST_TOKEN")
    return headers


# smoke test for /api/v1/products POST
def test_products_post():
    # Invocation of Skyramp Client and calling of authentication header
    client = skyramp.Client()
    headers = get_header()

    # Request Body
    products_POST_request_body = r'''{
            "category": "string",
            "description": "string",
            "image_url": "string",
            "in_stock": false,
            "name": "string",
            "price": 0
        }'''
    
    # Execute Request
    products_POST_response = client.send_request(
        url=URL,
        path="/api/v1/products",
        method="POST",
        body=products_POST_request_body,
        headers=headers
    )
    # Generated Assertions
    assert products_POST_response.status_code == 201

# smoke test for /api/v1/products GET
def test_products_get():
    # Invocation of Skyramp Client and calling of authentication header
    client = skyramp.Client()
    headers = get_header()

    # Execute Request
    products_GET_response = client.send_request(
        url=URL,
        path="/api/v1/products",
        method="GET",
        headers=headers,
        query_params={
            "limit": 10,
            "offset": 0,
            "order": "asc",
            "orderBy": None
        }
    )
    # Generated Assertions
    assert products_GET_response.status_code == 200

# smoke test for /api/v1/products/{product_id} GET
def test_products_product_id_get():
    # Invocation of Skyramp Client and calling of authentication header
    client = skyramp.Client()
    headers = get_header()

    # Declaration of variables
    product_id = 0

    # Execute Request
    products_product_id_GET_response = client.send_request(
        url=URL,
        path="/api/v1/products/{product_id}",
        method="GET",
        headers=headers,
        path_params={"product_id": product_id}
    )
    # Generated Assertions
    assert products_product_id_GET_response.status_code == 200

# smoke test for /api/v1/products/{product_id} PUT
def test_products_product_id_put():
    # Invocation of Skyramp Client and calling of authentication header
    client = skyramp.Client()
    headers = get_header()

    # Declaration of variables
    product_id = 0

    # Request Body
    products_product_id_PUT_request_body = r'''{
            "category": "string",
            "description": "string",
            "image_url": "string",
            "in_stock": false,
            "name": "string",
            "price": 0
        }'''
    
    # Execute Request
    products_product_id_PUT_response = client.send_request(
        url=URL,
        path="/api/v1/products/{product_id}",
        method="PUT",
        body=products_product_id_PUT_request_body,
        headers=headers,
        path_params={"product_id": product_id}
    )
    # Generated Assertions
    assert products_product_id_PUT_response.status_code == 200

# smoke test for /api/v1/products/{product_id} DELETE
def test_products_product_id_delete():
    # Invocation of Skyramp Client and calling of authentication header
    client = skyramp.Client()
    headers = get_header()

    # Declaration of variables
    product_id = 0

    # Execute Request
    products_product_id_DELETE_response = client.send_request(
        url=URL,
        path="/api/v1/products/{product_id}",
        method="DELETE",
        headers=headers,
        path_params={"product_id": product_id}
    )
    # Generated Assertions
    assert products_product_id_DELETE_response.status_code == 204

if __name__ == "__main__":
    test_products_post()
    test_products_get()
    test_products_product_id_get()
    test_products_product_id_put()
    test_products_product_id_delete()

Change Assertion(s)

You can change the assertion for any request by simply updating the assert statement, e.g.:

assert products_product_id_DELETE_response.status_code == 20X

Change Path Parameter(s)

To change the path parameter of any of the smoke test cases, add path_params to any relevant client.send_request calls. You can specify a variable or immediately adjust the value in the request object:

# Declaration of variables
product_id = 1
products_product_id_PUT_response = client.send_request(
        url=URL,
        path="/api/v1/products/{product_id}",
        method="PUT",
        body=products_product_id_PUT_request_body,
        headers=headers,
        path_params={"product_id": product_id}
    )

Change Query Parameter(s)

To change the query parameter of any of the smoke test cases, add query_params to any relevant client.send_request calls:

products_GET_response = client.send_request(
        url=URL,
        path="/api/v1/products",
        method="GET",
        headers=headers,
        query_params={
            "limit": 20,
            "offset": 0,
            "order": "asc",
            "orderBy": None
        }
    )

Python

Java

Typescript

Test Anatomy for All Methods of Endpoint

# Generated by Skyramp v1.2.1 on 2025-06-30 00:48:10.763141 -0700 PDT m=+0.912849584
# Command: skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
# 		--api-schema https://demoshop.skyramp.dev/openapi.json \
# 		--framework pytest \
# 		--language python \

# Import of required libraries
import skyramp
import os
import time
# URL for test requests
URL = "https://demoshop.skyramp.dev"

# Definition of authentication header
def get_header():
    headers = {}
    if os.getenv("SKYRAMP_TEST_TOKEN") is not None:
        headers["Authorization"] = "Bearer " + os.getenv("SKYRAMP_TEST_TOKEN")
    return headers


# smoke test for /api/v1/products POST
def test_products_post():
    # Invocation of Skyramp Client and calling of authentication header
    client = skyramp.Client()
    headers = get_header()

    # Request Body
    products_POST_request_body = r'''{
            "category": "string",
            "description": "string",
            "image_url": "string",
            "in_stock": false,
            "name": "string",
            "price": 0
        }'''
    
    # Execute Request
    products_POST_response = client.send_request(
        url=URL,
        path="/api/v1/products",
        method="POST",
        body=products_POST_request_body,
        headers=headers
    )
    # Generated Assertions
    assert products_POST_response.status_code == 201

# smoke test for /api/v1/products GET
def test_products_get():
    # Invocation of Skyramp Client and calling of authentication header
    client = skyramp.Client()
    headers = get_header()

    # Execute Request
    products_GET_response = client.send_request(
        url=URL,
        path="/api/v1/products",
        method="GET",
        headers=headers,
        query_params={
            "limit": 10,
            "offset": 0,
            "order": "asc",
            "orderBy": None
        }
    )
    # Generated Assertions
    assert products_GET_response.status_code == 200

# smoke test for /api/v1/products/{product_id} GET
def test_products_product_id_get():
    # Invocation of Skyramp Client and calling of authentication header
    client = skyramp.Client()
    headers = get_header()

    # Declaration of variables
    product_id = 0

    # Execute Request
    products_product_id_GET_response = client.send_request(
        url=URL,
        path="/api/v1/products/{product_id}",
        method="GET",
        headers=headers,
        path_params={"product_id": product_id}
    )
    # Generated Assertions
    assert products_product_id_GET_response.status_code == 200

# smoke test for /api/v1/products/{product_id} PUT
def test_products_product_id_put():
    # Invocation of Skyramp Client and calling of authentication header
    client = skyramp.Client()
    headers = get_header()

    # Declaration of variables
    product_id = 0

    # Request Body
    products_product_id_PUT_request_body = r'''{
            "category": "string",
            "description": "string",
            "image_url": "string",
            "in_stock": false,
            "name": "string",
            "price": 0
        }'''
    
    # Execute Request
    products_product_id_PUT_response = client.send_request(
        url=URL,
        path="/api/v1/products/{product_id}",
        method="PUT",
        body=products_product_id_PUT_request_body,
        headers=headers,
        path_params={"product_id": product_id}
    )
    # Generated Assertions
    assert products_product_id_PUT_response.status_code == 200

# smoke test for /api/v1/products/{product_id} DELETE
def test_products_product_id_delete():
    # Invocation of Skyramp Client and calling of authentication header
    client = skyramp.Client()
    headers = get_header()

    # Declaration of variables
    product_id = 0

    # Execute Request
    products_product_id_DELETE_response = client.send_request(
        url=URL,
        path="/api/v1/products/{product_id}",
        method="DELETE",
        headers=headers,
        path_params={"product_id": product_id}
    )
    # Generated Assertions
    assert products_product_id_DELETE_response.status_code == 204

if __name__ == "__main__":
    test_products_post()
    test_products_get()
    test_products_product_id_get()
    test_products_product_id_put()
    test_products_product_id_delete()

Change Assertion(s)

You can change the assertion for any request by simply updating the assert statement, e.g.:

assert products_product_id_DELETE_response.status_code == 20X

Change Path Parameter(s)

To change the path parameter of any of the smoke test cases, add path_params to any relevant client.send_request calls. You can specify a variable or immediately adjust the value in the request object:

# Declaration of variables
product_id = 1
products_product_id_PUT_response = client.send_request(
        url=URL,
        path="/api/v1/products/{product_id}",
        method="PUT",
        body=products_product_id_PUT_request_body,
        headers=headers,
        path_params={"product_id": product_id}
    )

Change Query Parameter(s)

To change the query parameter of any of the smoke test cases, add query_params to any relevant client.send_request calls:

products_GET_response = client.send_request(
        url=URL,
        path="/api/v1/products",
        method="GET",
        headers=headers,
        query_params={
            "limit": 20,
            "offset": 0,
            "order": "asc",
            "orderBy": None
        }
    )

Python

Java

Typescript

Test Anatomy for All Methods of Endpoint

# Generated by Skyramp v1.2.1 on 2025-06-30 00:48:10.763141 -0700 PDT m=+0.912849584
# Command: skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
# 		--api-schema https://demoshop.skyramp.dev/openapi.json \
# 		--framework pytest \
# 		--language python \

# Import of required libraries
import skyramp
import os
import time
# URL for test requests
URL = "https://demoshop.skyramp.dev"

# Definition of authentication header
def get_header():
    headers = {}
    if os.getenv("SKYRAMP_TEST_TOKEN") is not None:
        headers["Authorization"] = "Bearer " + os.getenv("SKYRAMP_TEST_TOKEN")
    return headers


# smoke test for /api/v1/products POST
def test_products_post():
    # Invocation of Skyramp Client and calling of authentication header
    client = skyramp.Client()
    headers = get_header()

    # Request Body
    products_POST_request_body = r'''{
            "category": "string",
            "description": "string",
            "image_url": "string",
            "in_stock": false,
            "name": "string",
            "price": 0
        }'''
    
    # Execute Request
    products_POST_response = client.send_request(
        url=URL,
        path="/api/v1/products",
        method="POST",
        body=products_POST_request_body,
        headers=headers
    )
    # Generated Assertions
    assert products_POST_response.status_code == 201

# smoke test for /api/v1/products GET
def test_products_get():
    # Invocation of Skyramp Client and calling of authentication header
    client = skyramp.Client()
    headers = get_header()

    # Execute Request
    products_GET_response = client.send_request(
        url=URL,
        path="/api/v1/products",
        method="GET",
        headers=headers,
        query_params={
            "limit": 10,
            "offset": 0,
            "order": "asc",
            "orderBy": None
        }
    )
    # Generated Assertions
    assert products_GET_response.status_code == 200

# smoke test for /api/v1/products/{product_id} GET
def test_products_product_id_get():
    # Invocation of Skyramp Client and calling of authentication header
    client = skyramp.Client()
    headers = get_header()

    # Declaration of variables
    product_id = 0

    # Execute Request
    products_product_id_GET_response = client.send_request(
        url=URL,
        path="/api/v1/products/{product_id}",
        method="GET",
        headers=headers,
        path_params={"product_id": product_id}
    )
    # Generated Assertions
    assert products_product_id_GET_response.status_code == 200

# smoke test for /api/v1/products/{product_id} PUT
def test_products_product_id_put():
    # Invocation of Skyramp Client and calling of authentication header
    client = skyramp.Client()
    headers = get_header()

    # Declaration of variables
    product_id = 0

    # Request Body
    products_product_id_PUT_request_body = r'''{
            "category": "string",
            "description": "string",
            "image_url": "string",
            "in_stock": false,
            "name": "string",
            "price": 0
        }'''
    
    # Execute Request
    products_product_id_PUT_response = client.send_request(
        url=URL,
        path="/api/v1/products/{product_id}",
        method="PUT",
        body=products_product_id_PUT_request_body,
        headers=headers,
        path_params={"product_id": product_id}
    )
    # Generated Assertions
    assert products_product_id_PUT_response.status_code == 200

# smoke test for /api/v1/products/{product_id} DELETE
def test_products_product_id_delete():
    # Invocation of Skyramp Client and calling of authentication header
    client = skyramp.Client()
    headers = get_header()

    # Declaration of variables
    product_id = 0

    # Execute Request
    products_product_id_DELETE_response = client.send_request(
        url=URL,
        path="/api/v1/products/{product_id}",
        method="DELETE",
        headers=headers,
        path_params={"product_id": product_id}
    )
    # Generated Assertions
    assert products_product_id_DELETE_response.status_code == 204

if __name__ == "__main__":
    test_products_post()
    test_products_get()
    test_products_product_id_get()
    test_products_product_id_put()
    test_products_product_id_delete()

Change Assertion(s)

You can change the assertion for any request by simply updating the assert statement, e.g.:

assert products_product_id_DELETE_response.status_code == 20X

Change Path Parameter(s)

To change the path parameter of any of the smoke test cases, add path_params to any relevant client.send_request calls. You can specify a variable or immediately adjust the value in the request object:

# Declaration of variables
product_id = 1
products_product_id_PUT_response = client.send_request(
        url=URL,
        path="/api/v1/products/{product_id}",
        method="PUT",
        body=products_product_id_PUT_request_body,
        headers=headers,
        path_params={"product_id": product_id}
    )

Change Query Parameter(s)

To change the query parameter of any of the smoke test cases, add query_params to any relevant client.send_request calls:

products_GET_response = client.send_request(
        url=URL,
        path="/api/v1/products",
        method="GET",
        headers=headers,
        query_params={
            "limit": 20,
            "offset": 0,
            "order": "asc",
            "orderBy": None
        }
    )

© 2025 Skyramp, Inc. All rights reserved.

© 2025 Skyramp, Inc. All rights reserved.

© 2025 Skyramp, Inc. All rights reserved.