Integration 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.

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

    • Invocation of Skyramp Client

    • Definition of the authentication header

    • A set of requests executed in sequence

      • Assertion against response status code per request

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.

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

    • Invocation of Skyramp Client

    • Definition of the authentication header

    • A set of requests executed in sequence

      • Assertion against response status code per request

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.

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

    • Invocation of Skyramp Client

    • Definition of the authentication header

    • A set of requests executed in sequence

      • Assertion against response status code per request

Python

Java

Typescript

Integration Test with OpenAPI Spec

For tests generated using an OpenAPI spec, Skyramp looks at the final path segment to identify the resource being tested and generates chained requests for all available methods (eg. POST, GET, PUT) of that resource such that the test completes a CRUD lifecycle (“create the resource, then update, then delete”).

  • ex. For https://demoshop.skyramp.dev/api/v1/products - the test will execute requests in the following order with a chained product ID:

    1. POST Product → returns an ID id

    2. GET Product w/ ID id

    3. PUT Product w/ ID id

    4. DELETE Product w/ ID id

# Generated by Skyramp v0.5.24 on 2025-06-23 13:36:57.691595 -0400 EDT m=+1.847630834
# Command: skyramp generate integration 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"

def test_integration():
    # Invocation of Skyramp Client
    client = skyramp.Client()
    # Definition of authentication header
    headers = {}
    if os.getenv("SKYRAMP_TEST_TOKEN") is not None:
        headers["Authorization"] = "Bearer " + os.getenv("SKYRAMP_TEST_TOKEN")

    # Request Body
    products_POST_request_body = r'''{
            "category": "Toys",
            "description": "Bear Soft Toy",
            "image_url": "https://images.app.goo.gl/cgcHpeehRdu5osot8",
            "in_stock": true,
            "name": "bigbear",
            "price": 9.99
        }'''
    
    # 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

    max_retries = 10
    sleep_time = 5
    for idx in range(max_retries):
        # 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": skyramp.get_response_value(products_POST_response, "product_id")}
        )
        if products_product_id_GET_response.status_code == 200:
            break
        time.sleep(sleep_time)


    # Request Body
    products_product_id_PUT_request_body = r'''{
            "category": "Toys",
            "description": "Bear Soft Toy",
            "image_url": "https://images.app.goo.gl/cgcHpeehRdu5osot8",
            "in_stock": true,
            "name": "bigbear",
            "price": 9.99
        }'''
    
    # 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": skyramp.get_response_value(products_POST_response, "product_id")}
    )
    # Generated Assertions
    assert products_product_id_PUT_response.status_code == 200

    # 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": skyramp.get_response_value(products_POST_response, "product_id")}
    )
    # Generated Assertions
    assert products_product_id_DELETE_response.status_code == 204

if __name__ == "__main__":
    test_integration()

Integration Test with Skyramp Trace

For tests generated using a Skyramp Trace, Skyramp builds the request based on the exact order of requests fired during trace collection.

Here is an example integration test built using the sample trace:

# Generated by Skyramp v0.5.24 on 2025-06-23 13:40:28.084126 -0400 EDT m=+0.698972585
# Command: skyramp generate integration rest \
# 		--framework pytest \
# 		--language python \
# 		--trace backend_test_trace.json \

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

def test_integration():
    # Invocation of Skyramp Client
    client = skyramp.Client()
    # Request Body
    products_POST_request_body = r'''{
        "category": "Phones",
        "description": "An iPhone powered by Skyramp",
        "image_url": "https://images.app.goo.gl/jGPHo3ZEzEbHG8o2A",
        "in_stock": true,
        "name": "SkyPhone 1",
        "price": 2023.99
    }'''
    
    # Execute Request
    products_POST_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/products",
        method="POST",
        body=products_POST_request_body
    )
    # Generated Assertions
    assert products_POST_response.status_code == 201

    # Execute Request
    products_GET_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/products",
        method="GET",
        headers={"Referer": "https://skyramp.dev/"},
        query_params={
            "limit": ["50"],
            "order": ["asc"],
            "orderBy": ["name"]
        }
    )
    # Generated Assertions
    assert products_GET_response.status_code == 200

    # Request Body
    orders_POST_request_body = r'''{
        "customer_email": "sahil@skyramp.dev",
        "items": [
            {
                "product_id": 24,
                "quantity": 2,
                "unit_price": 2023.99
            }
        ]
    }'''
    
    # Execute Request
    orders_POST_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/orders",
        method="POST",
        body=orders_POST_request_body,
        data_override={"items.0.product_id": skyramp.get_response_value(products_POST_response, "product_id")}
    )
    # Generated Assertions
    assert orders_POST_response.status_code == 201

    # Execute Request
    orders_GET_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/orders",
        method="GET",
        headers={"Referer": "https://skyramp.dev/"},
        query_params={"limit": ["50"]}
    )
    # Generated Assertions
    assert orders_GET_response.status_code == 200

    # Execute Request
    orders_orders_GET_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/orders/{orders}",
        method="GET",
        headers={"Referer": "https://skyramp.dev/"},
        path_params={"orders": skyramp.get_response_value(orders_GET_response, "12.order_id")}
    )
    # Generated Assertions
    assert orders_orders_GET_response.status_code == 200

    # Execute Request
    products_products_GET_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/products/{products}",
        method="GET",
        headers={"Referer": "https://skyramp.dev/"},
        path_params={"products": skyramp.get_response_value(products_GET_response, "21.product_id")}
    )
    # Generated Assertions
    assert products_products_GET_response.status_code == 200

    # Execute Request
    orders_orders_DELETE_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/orders/{orders}",
        method="DELETE",
        headers={"Referer": "https://skyramp.dev/"},
        path_params={"orders": skyramp.get_response_value(orders_GET_response, "12.order_id")}
    )
    # Generated Assertions
    assert orders_orders_DELETE_response.status_code == 200

    # Execute Request
    orders_GET_1_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/orders",
        method="GET",
        headers={"Referer": "https://skyramp.dev/"},
        query_params={"limit": ["50"]}
    )
    # Generated Assertions
    assert orders_GET_1_response.status_code == 200

if __name__ == "__main__":
    test_integration()

Python

Java

Typescript

Integration Test with OpenAPI Spec

For tests generated using an OpenAPI spec, Skyramp looks at the final path segment to identify the resource being tested and generates chained requests for all available methods (eg. POST, GET, PUT) of that resource such that the test completes a CRUD lifecycle (“create the resource, then update, then delete”).

  • ex. For https://demoshop.skyramp.dev/api/v1/products - the test will execute requests in the following order with a chained product ID:

    1. POST Product → returns an ID id

    2. GET Product w/ ID id

    3. PUT Product w/ ID id

    4. DELETE Product w/ ID id

# Generated by Skyramp v0.5.24 on 2025-06-23 13:36:57.691595 -0400 EDT m=+1.847630834
# Command: skyramp generate integration 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"

def test_integration():
    # Invocation of Skyramp Client
    client = skyramp.Client()
    # Definition of authentication header
    headers = {}
    if os.getenv("SKYRAMP_TEST_TOKEN") is not None:
        headers["Authorization"] = "Bearer " + os.getenv("SKYRAMP_TEST_TOKEN")

    # Request Body
    products_POST_request_body = r'''{
            "category": "Toys",
            "description": "Bear Soft Toy",
            "image_url": "https://images.app.goo.gl/cgcHpeehRdu5osot8",
            "in_stock": true,
            "name": "bigbear",
            "price": 9.99
        }'''
    
    # 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

    max_retries = 10
    sleep_time = 5
    for idx in range(max_retries):
        # 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": skyramp.get_response_value(products_POST_response, "product_id")}
        )
        if products_product_id_GET_response.status_code == 200:
            break
        time.sleep(sleep_time)


    # Request Body
    products_product_id_PUT_request_body = r'''{
            "category": "Toys",
            "description": "Bear Soft Toy",
            "image_url": "https://images.app.goo.gl/cgcHpeehRdu5osot8",
            "in_stock": true,
            "name": "bigbear",
            "price": 9.99
        }'''
    
    # 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": skyramp.get_response_value(products_POST_response, "product_id")}
    )
    # Generated Assertions
    assert products_product_id_PUT_response.status_code == 200

    # 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": skyramp.get_response_value(products_POST_response, "product_id")}
    )
    # Generated Assertions
    assert products_product_id_DELETE_response.status_code == 204

if __name__ == "__main__":
    test_integration()

Integration Test with Skyramp Trace

For tests generated using a Skyramp Trace, Skyramp builds the request based on the exact order of requests fired during trace collection.

Here is an example integration test built using the sample trace:

# Generated by Skyramp v0.5.24 on 2025-06-23 13:40:28.084126 -0400 EDT m=+0.698972585
# Command: skyramp generate integration rest \
# 		--framework pytest \
# 		--language python \
# 		--trace backend_test_trace.json \

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

def test_integration():
    # Invocation of Skyramp Client
    client = skyramp.Client()
    # Request Body
    products_POST_request_body = r'''{
        "category": "Phones",
        "description": "An iPhone powered by Skyramp",
        "image_url": "https://images.app.goo.gl/jGPHo3ZEzEbHG8o2A",
        "in_stock": true,
        "name": "SkyPhone 1",
        "price": 2023.99
    }'''
    
    # Execute Request
    products_POST_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/products",
        method="POST",
        body=products_POST_request_body
    )
    # Generated Assertions
    assert products_POST_response.status_code == 201

    # Execute Request
    products_GET_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/products",
        method="GET",
        headers={"Referer": "https://skyramp.dev/"},
        query_params={
            "limit": ["50"],
            "order": ["asc"],
            "orderBy": ["name"]
        }
    )
    # Generated Assertions
    assert products_GET_response.status_code == 200

    # Request Body
    orders_POST_request_body = r'''{
        "customer_email": "sahil@skyramp.dev",
        "items": [
            {
                "product_id": 24,
                "quantity": 2,
                "unit_price": 2023.99
            }
        ]
    }'''
    
    # Execute Request
    orders_POST_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/orders",
        method="POST",
        body=orders_POST_request_body,
        data_override={"items.0.product_id": skyramp.get_response_value(products_POST_response, "product_id")}
    )
    # Generated Assertions
    assert orders_POST_response.status_code == 201

    # Execute Request
    orders_GET_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/orders",
        method="GET",
        headers={"Referer": "https://skyramp.dev/"},
        query_params={"limit": ["50"]}
    )
    # Generated Assertions
    assert orders_GET_response.status_code == 200

    # Execute Request
    orders_orders_GET_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/orders/{orders}",
        method="GET",
        headers={"Referer": "https://skyramp.dev/"},
        path_params={"orders": skyramp.get_response_value(orders_GET_response, "12.order_id")}
    )
    # Generated Assertions
    assert orders_orders_GET_response.status_code == 200

    # Execute Request
    products_products_GET_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/products/{products}",
        method="GET",
        headers={"Referer": "https://skyramp.dev/"},
        path_params={"products": skyramp.get_response_value(products_GET_response, "21.product_id")}
    )
    # Generated Assertions
    assert products_products_GET_response.status_code == 200

    # Execute Request
    orders_orders_DELETE_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/orders/{orders}",
        method="DELETE",
        headers={"Referer": "https://skyramp.dev/"},
        path_params={"orders": skyramp.get_response_value(orders_GET_response, "12.order_id")}
    )
    # Generated Assertions
    assert orders_orders_DELETE_response.status_code == 200

    # Execute Request
    orders_GET_1_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/orders",
        method="GET",
        headers={"Referer": "https://skyramp.dev/"},
        query_params={"limit": ["50"]}
    )
    # Generated Assertions
    assert orders_GET_1_response.status_code == 200

if __name__ == "__main__":
    test_integration()

Python

Java

Typescript

Integration Test with OpenAPI Spec

For tests generated using an OpenAPI spec, Skyramp looks at the final path segment to identify the resource being tested and generates chained requests for all available methods (eg. POST, GET, PUT) of that resource such that the test completes a CRUD lifecycle (“create the resource, then update, then delete”).

  • ex. For https://demoshop.skyramp.dev/api/v1/products - the test will execute requests in the following order with a chained product ID:

    1. POST Product → returns an ID id

    2. GET Product w/ ID id

    3. PUT Product w/ ID id

    4. DELETE Product w/ ID id

# Generated by Skyramp v0.5.24 on 2025-06-23 13:36:57.691595 -0400 EDT m=+1.847630834
# Command: skyramp generate integration 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"

def test_integration():
    # Invocation of Skyramp Client
    client = skyramp.Client()
    # Definition of authentication header
    headers = {}
    if os.getenv("SKYRAMP_TEST_TOKEN") is not None:
        headers["Authorization"] = "Bearer " + os.getenv("SKYRAMP_TEST_TOKEN")

    # Request Body
    products_POST_request_body = r'''{
            "category": "Toys",
            "description": "Bear Soft Toy",
            "image_url": "https://images.app.goo.gl/cgcHpeehRdu5osot8",
            "in_stock": true,
            "name": "bigbear",
            "price": 9.99
        }'''
    
    # 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

    max_retries = 10
    sleep_time = 5
    for idx in range(max_retries):
        # 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": skyramp.get_response_value(products_POST_response, "product_id")}
        )
        if products_product_id_GET_response.status_code == 200:
            break
        time.sleep(sleep_time)


    # Request Body
    products_product_id_PUT_request_body = r'''{
            "category": "Toys",
            "description": "Bear Soft Toy",
            "image_url": "https://images.app.goo.gl/cgcHpeehRdu5osot8",
            "in_stock": true,
            "name": "bigbear",
            "price": 9.99
        }'''
    
    # 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": skyramp.get_response_value(products_POST_response, "product_id")}
    )
    # Generated Assertions
    assert products_product_id_PUT_response.status_code == 200

    # 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": skyramp.get_response_value(products_POST_response, "product_id")}
    )
    # Generated Assertions
    assert products_product_id_DELETE_response.status_code == 204

if __name__ == "__main__":
    test_integration()

Integration Test with Skyramp Trace

For tests generated using a Skyramp Trace, Skyramp builds the request based on the exact order of requests fired during trace collection.

Here is an example integration test built using the sample trace:

# Generated by Skyramp v0.5.24 on 2025-06-23 13:40:28.084126 -0400 EDT m=+0.698972585
# Command: skyramp generate integration rest \
# 		--framework pytest \
# 		--language python \
# 		--trace backend_test_trace.json \

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

def test_integration():
    # Invocation of Skyramp Client
    client = skyramp.Client()
    # Request Body
    products_POST_request_body = r'''{
        "category": "Phones",
        "description": "An iPhone powered by Skyramp",
        "image_url": "https://images.app.goo.gl/jGPHo3ZEzEbHG8o2A",
        "in_stock": true,
        "name": "SkyPhone 1",
        "price": 2023.99
    }'''
    
    # Execute Request
    products_POST_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/products",
        method="POST",
        body=products_POST_request_body
    )
    # Generated Assertions
    assert products_POST_response.status_code == 201

    # Execute Request
    products_GET_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/products",
        method="GET",
        headers={"Referer": "https://skyramp.dev/"},
        query_params={
            "limit": ["50"],
            "order": ["asc"],
            "orderBy": ["name"]
        }
    )
    # Generated Assertions
    assert products_GET_response.status_code == 200

    # Request Body
    orders_POST_request_body = r'''{
        "customer_email": "sahil@skyramp.dev",
        "items": [
            {
                "product_id": 24,
                "quantity": 2,
                "unit_price": 2023.99
            }
        ]
    }'''
    
    # Execute Request
    orders_POST_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/orders",
        method="POST",
        body=orders_POST_request_body,
        data_override={"items.0.product_id": skyramp.get_response_value(products_POST_response, "product_id")}
    )
    # Generated Assertions
    assert orders_POST_response.status_code == 201

    # Execute Request
    orders_GET_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/orders",
        method="GET",
        headers={"Referer": "https://skyramp.dev/"},
        query_params={"limit": ["50"]}
    )
    # Generated Assertions
    assert orders_GET_response.status_code == 200

    # Execute Request
    orders_orders_GET_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/orders/{orders}",
        method="GET",
        headers={"Referer": "https://skyramp.dev/"},
        path_params={"orders": skyramp.get_response_value(orders_GET_response, "12.order_id")}
    )
    # Generated Assertions
    assert orders_orders_GET_response.status_code == 200

    # Execute Request
    products_products_GET_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/products/{products}",
        method="GET",
        headers={"Referer": "https://skyramp.dev/"},
        path_params={"products": skyramp.get_response_value(products_GET_response, "21.product_id")}
    )
    # Generated Assertions
    assert products_products_GET_response.status_code == 200

    # Execute Request
    orders_orders_DELETE_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/orders/{orders}",
        method="DELETE",
        headers={"Referer": "https://skyramp.dev/"},
        path_params={"orders": skyramp.get_response_value(orders_GET_response, "12.order_id")}
    )
    # Generated Assertions
    assert orders_orders_DELETE_response.status_code == 200

    # Execute Request
    orders_GET_1_response = client.send_request(
        url=URL_demoshop,
        path="/api/v1/orders",
        method="GET",
        headers={"Referer": "https://skyramp.dev/"},
        query_params={"limit": ["50"]}
    )
    # Generated Assertions
    assert orders_GET_1_response.status_code == 200

if __name__ == "__main__":
    test_integration()

© 2025 Skyramp, Inc. All rights reserved.

© 2025 Skyramp, Inc. All rights reserved.

© 2025 Skyramp, Inc. All rights reserved.