Generation

Getting Started

Getting Started

Integration Test

Integration Testing

This guide describes generating integration tests using the Skyramp CLI. Throughout this guide, we are using Skyramp’s Demo Shop API as an example REST API. You can find all relevant information on the Demo Shop here.

If you haven’t already installed Skyramp, follow the instructions here.

1. Overview

Integration testing verifies that different components of a system work together as expected. It catches issues arising from interactions between modules, APIs, or external systems that unit tests might miss. By validating data flow, dependencies, and system behavior, integration testing ensures software functions reliably in real-world environments.

2. Generate Integration Test for REST APIs

This section explains how you can use Skyramp to generate integration tests for REST APIs in Python. You can generate integration tests for:

  • all methods of an endpoint.

To reliably generate test cases, we require at least one of the following inputs:

  • OpenAPI schema (required if generating for all methods of an endpoint)

    • Can be provided as JSON or YAML file

Integration Testing

This guide describes generating integration tests using the Skyramp CLI. Throughout this guide, we are using Skyramp’s Demo Shop API as an example REST API. You can find all relevant information on the Demo Shop here.

If you haven’t already installed Skyramp, follow the instructions here.

1. Overview

Integration testing verifies that different components of a system work together as expected. It catches issues arising from interactions between modules, APIs, or external systems that unit tests might miss. By validating data flow, dependencies, and system behavior, integration testing ensures software functions reliably in real-world environments.

2. Generate Integration Test for REST APIs

This section explains how you can use Skyramp to generate integration tests for REST APIs in Python. You can generate integration tests for:

  • all methods of an endpoint.

To reliably generate test cases, we require at least one of the following inputs:

  • OpenAPI schema (required if generating for all methods of an endpoint)

    • Can be provided as JSON or YAML file

Integration Testing

This guide describes generating integration tests using the Skyramp CLI. Throughout this guide, we are using Skyramp’s Demo Shop API as an example REST API. You can find all relevant information on the Demo Shop here.

If you haven’t already installed Skyramp, follow the instructions here.

1. Overview

Integration testing verifies that different components of a system work together as expected. It catches issues arising from interactions between modules, APIs, or external systems that unit tests might miss. By validating data flow, dependencies, and system behavior, integration testing ensures software functions reliably in real-world environments.

2. Generate Integration Test for REST APIs

This section explains how you can use Skyramp to generate integration tests for REST APIs in Python. You can generate integration tests for:

  • all methods of an endpoint.

To reliably generate test cases, we require at least one of the following inputs:

  • OpenAPI schema (required if generating for all methods of an endpoint)

    • Can be provided as JSON or YAML file

Python

2.1 Generate Command

Skyramp generates test cases for all methods for the specified path/url and its direct children. For cases, where the direct parent path/url has relevant methods, Skyramp will also generate test cases.

We are using https://demoshop.skyramp.dev/api/v1/products as a placeholder here for your <url-to-endpoint>.

skyramp generate integration rest https://demoshop.skyramp.dev/api/v1/products \
--language python \
--framework robot \
--api-schema openapi.json

This command generates two files:

  • products_integration_test.py

  • products_integration_test.robot (simple Robot wrapper file)

The content of the generated test is explained in Section 4 below.

Adjustments

Below are a few flags to customize the test generation. Additional flags are explained here.

  • --runtime: Allows you to specify the environment in which you want the test to run [docker, k8s, local]

  • --auth-header: This flag allows you to specify the key of your authentication header, e.g. --auth-header X-API-KEY. By default, we assume Bearer.

  • --path-params: This flag allows you to override path parameters from your endpoint URL or the pre-defined values in the API schema, e.g. --path-params id=3fa85f64-5717-4562-b3fc-2c963f66afa6

  • --output: Allows you to specify the name of the generated test file.

  • --output-dir: Allows you to specify the directory to store the generated test file.

3. Execute Integration Test

You can execute the generated tests without any additional adjustments to the code.

3.1 Set env variable for authentication

Ensure proper authentication for test execution. By default, we expect a Bearer Token but support additional authentication methods. If your API does not require any authentication, you can skip this step and just run the test.

export SKYRAMP_TEST_TOKEN=$your_auth_token

3.2 Run the test

We now run the test using the Robot Framework. You can call the generated Python file either in an existing robot file of yours or leverage the simple wrapper file we generate.

# Prerequisites
pip install robotframework

# Execution of integration test for products/POST 
robot products_integration_test.robot

3.3 Results

As we use the Robot Framework to execute the test in this example, you can expect both the typical stdout from Robot and the generated files (output, log, report). You can find more information on the generated outputs in the Robot documentation.

3.3.1 Successful Test

The generated test passes out of the box.

3.3.2 Test Failure

For this section, we intentionally changed the request body to create a failure. You can find more detailed information about the test failure in the report.html and log.html.

4. Skyramp Test File

This section explains the key elements of the generated tests. This will enable you to make adjustments when needed quickly.

  • At the top of each file, we show when the test was generated and what command was used

  • Below, we import all relevant libraries and specify the URL for all test requests

  • We define a function for the integration test. It consists of:

    • Invocation of Skyramp Client (includes information about the runtime and framework)

    • Definition of the authentication header

    • For each method of the endpoint:

      • If applicable, definition of the request body (based on API schema or sample data)

      • Creation of the request

      • Status Code assertion

Test Execution Behavior

A generated integration test based on an API schema is performing a basic CRUD scenario. It chains the requests by extracting the unique_id from the response body of the POST method.

  • The test will either use sample data from the schema or provided request data from the generate command to define the request body for the POST method.

  • The test will then perform a GET to retrieve the just previously added object. To avoid flakiness due to delays in the backend of the tested service, the test will retry the GET method multiple times.

  • Next, the test will perform a PUT method based on a sample request body from the API schema.

  • Lastly, the test will delete the previously added and adjusted object

4.1 Generated Test

# Generated by Skyramp v0.5.0.af68db77 on 2025-02-13 09:05:34.615764 -0500 EST m=+0.225917418
# Command: skyramp generate integration rest https://demoshop.skyramp.dev/api/v1/products \
# 		--api-schema openapi.json \
# 		--framework robot \
# 		--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(
        framework="robot"
    )
    # Definition of authentication header
    headers = {}
    if os.getenv("SKYRAMP_TEST_TOKEN") is not None:
        headers["Authorization"] = "Bearer " + os.getenv("SKYRAMP_TEST_TOKEN")


    #POST REQUEST 
    
    # Request Body
    products_POST_request_body = r'''{
            "category": "string",
            "description": "string",
            "image_url": "string",
            "in_stock": "strin",
            "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


    # GET REQUEST 
    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, "id")}
        )
        if products_product_id_GET_response.status_code == 200:
            break
        time.sleep(sleep_time)
    # Generated Assertions
    assert products_product_id_GET_response.status_code == 200

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

if __name__ == "__main__":
    test_integration()

5. Customize Test Generation

This section includes a few additional examples that show different combinations of flags.

5.1 Change of Authentication Header

The additional flags allow you to change the authentication header.

skyramp generate integration rest https://demoshop.skyramp.dev/api/v1/products \
--language python \
--framework robot \
--auth-header X-API-KEY \
--api-schema openapi.json

5.2 Specification of request data

The additional flags allow you to override the POST request data of the test.

data.json

{
  "category": "electronics",
  "description": "speaker",
  "image_url": "photo",
  "in_stock": true,
  "name": "boombox",
  "price": 25
}

Generate Command

skyramp generate integration rest https://demoshop.skyramp.dev/api/v1/products \
--language python \
--framework robot \
--request-data @data.json \
--api-schema openapi.json

Python

2.1 Generate Command

Skyramp generates test cases for all methods for the specified path/url and its direct children. For cases, where the direct parent path/url has relevant methods, Skyramp will also generate test cases.

We are using https://demoshop.skyramp.dev/api/v1/products as a placeholder here for your <url-to-endpoint>.

skyramp generate integration rest https://demoshop.skyramp.dev/api/v1/products \
--language python \
--framework robot \
--api-schema openapi.json

This command generates two files:

  • products_integration_test.py

  • products_integration_test.robot (simple Robot wrapper file)

The content of the generated test is explained in Section 4 below.

Adjustments

Below are a few flags to customize the test generation. Additional flags are explained here.

  • --runtime: Allows you to specify the environment in which you want the test to run [docker, k8s, local]

  • --auth-header: This flag allows you to specify the key of your authentication header, e.g. --auth-header X-API-KEY. By default, we assume Bearer.

  • --path-params: This flag allows you to override path parameters from your endpoint URL or the pre-defined values in the API schema, e.g. --path-params id=3fa85f64-5717-4562-b3fc-2c963f66afa6

  • --output: Allows you to specify the name of the generated test file.

  • --output-dir: Allows you to specify the directory to store the generated test file.

3. Execute Integration Test

You can execute the generated tests without any additional adjustments to the code.

3.1 Set env variable for authentication

Ensure proper authentication for test execution. By default, we expect a Bearer Token but support additional authentication methods. If your API does not require any authentication, you can skip this step and just run the test.

export SKYRAMP_TEST_TOKEN=$your_auth_token

3.2 Run the test

We now run the test using the Robot Framework. You can call the generated Python file either in an existing robot file of yours or leverage the simple wrapper file we generate.

# Prerequisites
pip install robotframework

# Execution of integration test for products/POST 
robot products_integration_test.robot

3.3 Results

As we use the Robot Framework to execute the test in this example, you can expect both the typical stdout from Robot and the generated files (output, log, report). You can find more information on the generated outputs in the Robot documentation.

3.3.1 Successful Test

The generated test passes out of the box.

3.3.2 Test Failure

For this section, we intentionally changed the request body to create a failure. You can find more detailed information about the test failure in the report.html and log.html.

4. Skyramp Test File

This section explains the key elements of the generated tests. This will enable you to make adjustments when needed quickly.

  • At the top of each file, we show when the test was generated and what command was used

  • Below, we import all relevant libraries and specify the URL for all test requests

  • We define a function for the integration test. It consists of:

    • Invocation of Skyramp Client (includes information about the runtime and framework)

    • Definition of the authentication header

    • For each method of the endpoint:

      • If applicable, definition of the request body (based on API schema or sample data)

      • Creation of the request

      • Status Code assertion

Test Execution Behavior

A generated integration test based on an API schema is performing a basic CRUD scenario. It chains the requests by extracting the unique_id from the response body of the POST method.

  • The test will either use sample data from the schema or provided request data from the generate command to define the request body for the POST method.

  • The test will then perform a GET to retrieve the just previously added object. To avoid flakiness due to delays in the backend of the tested service, the test will retry the GET method multiple times.

  • Next, the test will perform a PUT method based on a sample request body from the API schema.

  • Lastly, the test will delete the previously added and adjusted object

4.1 Generated Test

# Generated by Skyramp v0.5.0.af68db77 on 2025-02-13 09:05:34.615764 -0500 EST m=+0.225917418
# Command: skyramp generate integration rest https://demoshop.skyramp.dev/api/v1/products \
# 		--api-schema openapi.json \
# 		--framework robot \
# 		--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(
        framework="robot"
    )
    # Definition of authentication header
    headers = {}
    if os.getenv("SKYRAMP_TEST_TOKEN") is not None:
        headers["Authorization"] = "Bearer " + os.getenv("SKYRAMP_TEST_TOKEN")


    #POST REQUEST 
    
    # Request Body
    products_POST_request_body = r'''{
            "category": "string",
            "description": "string",
            "image_url": "string",
            "in_stock": "strin",
            "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


    # GET REQUEST 
    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, "id")}
        )
        if products_product_id_GET_response.status_code == 200:
            break
        time.sleep(sleep_time)
    # Generated Assertions
    assert products_product_id_GET_response.status_code == 200

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

if __name__ == "__main__":
    test_integration()

5. Customize Test Generation

This section includes a few additional examples that show different combinations of flags.

5.1 Change of Authentication Header

The additional flags allow you to change the authentication header.

skyramp generate integration rest https://demoshop.skyramp.dev/api/v1/products \
--language python \
--framework robot \
--auth-header X-API-KEY \
--api-schema openapi.json

5.2 Specification of request data

The additional flags allow you to override the POST request data of the test.

data.json

{
  "category": "electronics",
  "description": "speaker",
  "image_url": "photo",
  "in_stock": true,
  "name": "boombox",
  "price": 25
}

Generate Command

skyramp generate integration rest https://demoshop.skyramp.dev/api/v1/products \
--language python \
--framework robot \
--request-data @data.json \
--api-schema openapi.json

Python

2.1 Generate Command

Skyramp generates test cases for all methods for the specified path/url and its direct children. For cases, where the direct parent path/url has relevant methods, Skyramp will also generate test cases.

We are using https://demoshop.skyramp.dev/api/v1/products as a placeholder here for your <url-to-endpoint>.

skyramp generate integration rest https://demoshop.skyramp.dev/api/v1/products \
--language python \
--framework robot \
--api-schema openapi.json

This command generates two files:

  • products_integration_test.py

  • products_integration_test.robot (simple Robot wrapper file)

The content of the generated test is explained in Section 4 below.

Adjustments

Below are a few flags to customize the test generation. Additional flags are explained here.

  • --runtime: Allows you to specify the environment in which you want the test to run [docker, k8s, local]

  • --auth-header: This flag allows you to specify the key of your authentication header, e.g. --auth-header X-API-KEY. By default, we assume Bearer.

  • --path-params: This flag allows you to override path parameters from your endpoint URL or the pre-defined values in the API schema, e.g. --path-params id=3fa85f64-5717-4562-b3fc-2c963f66afa6

  • --output: Allows you to specify the name of the generated test file.

  • --output-dir: Allows you to specify the directory to store the generated test file.

3. Execute Integration Test

You can execute the generated tests without any additional adjustments to the code.

3.1 Set env variable for authentication

Ensure proper authentication for test execution. By default, we expect a Bearer Token but support additional authentication methods. If your API does not require any authentication, you can skip this step and just run the test.

export SKYRAMP_TEST_TOKEN=$your_auth_token

3.2 Run the test

We now run the test using the Robot Framework. You can call the generated Python file either in an existing robot file of yours or leverage the simple wrapper file we generate.

# Prerequisites
pip install robotframework

# Execution of integration test for products/POST 
robot products_integration_test.robot

3.3 Results

As we use the Robot Framework to execute the test in this example, you can expect both the typical stdout from Robot and the generated files (output, log, report). You can find more information on the generated outputs in the Robot documentation.

3.3.1 Successful Test

The generated test passes out of the box.

3.3.2 Test Failure

For this section, we intentionally changed the request body to create a failure. You can find more detailed information about the test failure in the report.html and log.html.

4. Skyramp Test File

This section explains the key elements of the generated tests. This will enable you to make adjustments when needed quickly.

  • At the top of each file, we show when the test was generated and what command was used

  • Below, we import all relevant libraries and specify the URL for all test requests

  • We define a function for the integration test. It consists of:

    • Invocation of Skyramp Client (includes information about the runtime and framework)

    • Definition of the authentication header

    • For each method of the endpoint:

      • If applicable, definition of the request body (based on API schema or sample data)

      • Creation of the request

      • Status Code assertion

Test Execution Behavior

A generated integration test based on an API schema is performing a basic CRUD scenario. It chains the requests by extracting the unique_id from the response body of the POST method.

  • The test will either use sample data from the schema or provided request data from the generate command to define the request body for the POST method.

  • The test will then perform a GET to retrieve the just previously added object. To avoid flakiness due to delays in the backend of the tested service, the test will retry the GET method multiple times.

  • Next, the test will perform a PUT method based on a sample request body from the API schema.

  • Lastly, the test will delete the previously added and adjusted object

4.1 Generated Test

# Generated by Skyramp v0.5.0.af68db77 on 2025-02-13 09:05:34.615764 -0500 EST m=+0.225917418
# Command: skyramp generate integration rest https://demoshop.skyramp.dev/api/v1/products \
# 		--api-schema openapi.json \
# 		--framework robot \
# 		--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(
        framework="robot"
    )
    # Definition of authentication header
    headers = {}
    if os.getenv("SKYRAMP_TEST_TOKEN") is not None:
        headers["Authorization"] = "Bearer " + os.getenv("SKYRAMP_TEST_TOKEN")


    #POST REQUEST 
    
    # Request Body
    products_POST_request_body = r'''{
            "category": "string",
            "description": "string",
            "image_url": "string",
            "in_stock": "strin",
            "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


    # GET REQUEST 
    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, "id")}
        )
        if products_product_id_GET_response.status_code == 200:
            break
        time.sleep(sleep_time)
    # Generated Assertions
    assert products_product_id_GET_response.status_code == 200

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

if __name__ == "__main__":
    test_integration()

5. Customize Test Generation

This section includes a few additional examples that show different combinations of flags.

5.1 Change of Authentication Header

The additional flags allow you to change the authentication header.

skyramp generate integration rest https://demoshop.skyramp.dev/api/v1/products \
--language python \
--framework robot \
--auth-header X-API-KEY \
--api-schema openapi.json

5.2 Specification of request data

The additional flags allow you to override the POST request data of the test.

data.json

{
  "category": "electronics",
  "description": "speaker",
  "image_url": "photo",
  "in_stock": true,
  "name": "boombox",
  "price": 25
}

Generate Command

skyramp generate integration rest https://demoshop.skyramp.dev/api/v1/products \
--language python \
--framework robot \
--request-data @data.json \
--api-schema openapi.json

Python

Typescript

1.1 Generate Command

To create a smoke test for an endpoint, specify the endpoint you want to test. In this example, we are using the https://demoshop.skyramp.dev/api/v1/products as the URL to our service. When testing your service, replace it with the URL to the endpoint you want to test.

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
--language python \
--framework pytest \
--api-schema openapi.json

This command generates a smoke test file: products_smoke_test.py.

1.2 Execute Smoke Test

You can execute the generated tests without any additional adjustments to the code. However, based on the application you want to test, you can pass your authentication token to Skyramp Tests via an environment variable.

1.2.1 Set environment variables for authentication (if applicable)

Skyramp’s sample application doesn't require any authentication.

To test against an application that does require authentication, pass your token using an environment variable. By default, Skyramp expects a Bearer Token but we support additional authentication methods, as you can see in the examples below in Section 2.

export SKYRAMP_TEST_TOKEN=$your_auth_token

1.2.2 Run the test

Run the tests using Pytest. If you don’t have Pytest, install it with pip by running the following command in your terminal:

# Prerequisites 
pip install pytest

# Execution of smoke test for products/POST 
python3 -m pytest products_smoke_test.py

1.2.3 Results

We are using Pytest’s default test output in this guide, printing a line for each test that is being run and listing all failures at the end. You can adjust the output behavior following this documentation.

We can see that the test checks 5 methods that all test cases pass.

2. Customize Test Generation

2.1 Generation from Request Data

Instead of using your API spec, Skyramp you can also generate smoke tests based on sample request data. This enables users to quickly generate tests if no API spec is available or test scenarios that depend on specific data.

This requires you to specify the method you want to test.

request.json

{
    "category": "electronics",
    "description": "speaker",
    "image_url": "photo",
    "in_stock": false,
    "name": "boombox",
    "price": 25
}

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--request-data @request.json

2.2 Specification of form parameters for POST request

For POST requests, you can also provide form parameters instead of an API schema or sample request data to define the request body.

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--form-params category=electronics \
--form-params description=speaker \
--form-params image_url=photo \
--form-params in_stock=false \
--form-params name=boombox \
--form-params price=25

2.3 Change the authentication type

By default, Skyramp assumes a Bearer token. You can define the key of your authentication header with the auth-header flag.

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--auth-header X-API-KEY \
--api-schema openapi.json

2.4 Specification of path parameters

Skyramp also allows you to define path param in the generation command. The path-param flag will override all relevant path parameters with your specified value.

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products/{product_id} \
--language python \
--framework pytest \
--path-params product_id=2 \
--api-schema openapi.json

2.5 Specification of query parameters

You can specify query parameters when generating tests for a specific method.

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X GET \
--language python \
--framework pytest \
--query-params limit=5 \
--query-params order=desc \
--api-schema openapi.json

2.6 Specification of test name and directory

If desired, you can override the default test name and specify the directory to save the generated test.

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema openapi.json \
--output post_products_smoke_test.py \
--output-dir skyramp_tests

2.7 Test generation for Robot framework

Next to Pytest, Skyramp also supports the Robotframework in Python. This section shows you how to generate and execute tests using it instead of Pytest.

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework robot \
--api-schema openapi.json

This command generates two files:

  • products_smoke_test.py

  • products_smoke_test.robot(simple Robot wrapper file)

Execute Test

Run the test using the Robotframework. You can reference the generated Python file either in an existing robot file of yours or leverage the simple wrapper file we generate.

# Prerequisites
pip install robotframework

# Execution of smoke test for products/POST 
python3 -m robot products_smoke_test.robot

The results will be outputted following the typical stdout from Robot. You can find more information on the generated outputs in the Robot documentation.

2.8 Change the test execution runtime to Docker

Instead of using “local” execution, Skyramp also supports seamless support for testing applications in your docker network. This allows you to test your services without worrying about network configurations and port mapping while developing locally.

During test execution, we automatically deploy our Skyramp Worker into the specified Docker network and send the requests from within the network.

Generate Command

skyramp generate smoke rest http://api-sample:8000/api/v1/products \
-X POST \
--language python \
--framework pytest \
--runtime docker \
--docker-network api-insight_default \
--docker-skyramp-port 35142 \
--api-schema openapi.json

2.9 Deploy the Skyramp Dashboard

Next to the stdout of the test frameworks, Skyramp offers a simple dashboard to collect and help you analyze your test results. The Skyramp Dashboard is a lightweight Docker image that will automatically be brought up when executing the test. Please specify the --deploy-dashboard flag in the generation command.

Post execution, the dashboard will be available under http://localhost:3000/tests.

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema openapi.json \
--deploy-dashboard

Python

Typescript

1.1 Generate Command

To create a smoke test for an endpoint, specify the endpoint you want to test. In this example, we are using the https://demoshop.skyramp.dev/api/v1/products as the URL to our service. When testing your service, replace it with the URL to the endpoint you want to test.

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
--language python \
--framework pytest \
--api-schema openapi.json

This command generates a smoke test file: products_smoke_test.py.

1.2 Execute Smoke Test

You can execute the generated tests without any additional adjustments to the code. However, based on the application you want to test, you can pass your authentication token to Skyramp Tests via an environment variable.

1.2.1 Set environment variables for authentication (if applicable)

Skyramp’s sample application doesn't require any authentication.

To test against an application that does require authentication, pass your token using an environment variable. By default, Skyramp expects a Bearer Token but we support additional authentication methods, as you can see in the examples below in Section 2.

export SKYRAMP_TEST_TOKEN=$your_auth_token

1.2.2 Run the test

Run the tests using Pytest. If you don’t have Pytest, install it with pip by running the following command in your terminal:

# Prerequisites 
pip install pytest

# Execution of smoke test for products/POST 
python3 -m pytest products_smoke_test.py

1.2.3 Results

We are using Pytest’s default test output in this guide, printing a line for each test that is being run and listing all failures at the end. You can adjust the output behavior following this documentation.

We can see that the test checks 5 methods that all test cases pass.

2. Customize Test Generation

2.1 Generation from Request Data

Instead of using your API spec, Skyramp you can also generate smoke tests based on sample request data. This enables users to quickly generate tests if no API spec is available or test scenarios that depend on specific data.

This requires you to specify the method you want to test.

request.json

{
    "category": "electronics",
    "description": "speaker",
    "image_url": "photo",
    "in_stock": false,
    "name": "boombox",
    "price": 25
}

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--request-data @request.json

2.2 Specification of form parameters for POST request

For POST requests, you can also provide form parameters instead of an API schema or sample request data to define the request body.

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--form-params category=electronics \
--form-params description=speaker \
--form-params image_url=photo \
--form-params in_stock=false \
--form-params name=boombox \
--form-params price=25

2.3 Change the authentication type

By default, Skyramp assumes a Bearer token. You can define the key of your authentication header with the auth-header flag.

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--auth-header X-API-KEY \
--api-schema openapi.json

2.4 Specification of path parameters

Skyramp also allows you to define path param in the generation command. The path-param flag will override all relevant path parameters with your specified value.

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products/{product_id} \
--language python \
--framework pytest \
--path-params product_id=2 \
--api-schema openapi.json

2.5 Specification of query parameters

You can specify query parameters when generating tests for a specific method.

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X GET \
--language python \
--framework pytest \
--query-params limit=5 \
--query-params order=desc \
--api-schema openapi.json

2.6 Specification of test name and directory

If desired, you can override the default test name and specify the directory to save the generated test.

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema openapi.json \
--output post_products_smoke_test.py \
--output-dir skyramp_tests

2.7 Test generation for Robot framework

Next to Pytest, Skyramp also supports the Robotframework in Python. This section shows you how to generate and execute tests using it instead of Pytest.

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework robot \
--api-schema openapi.json

This command generates two files:

  • products_smoke_test.py

  • products_smoke_test.robot(simple Robot wrapper file)

Execute Test

Run the test using the Robotframework. You can reference the generated Python file either in an existing robot file of yours or leverage the simple wrapper file we generate.

# Prerequisites
pip install robotframework

# Execution of smoke test for products/POST 
python3 -m robot products_smoke_test.robot

The results will be outputted following the typical stdout from Robot. You can find more information on the generated outputs in the Robot documentation.

2.8 Change the test execution runtime to Docker

Instead of using “local” execution, Skyramp also supports seamless support for testing applications in your docker network. This allows you to test your services without worrying about network configurations and port mapping while developing locally.

During test execution, we automatically deploy our Skyramp Worker into the specified Docker network and send the requests from within the network.

Generate Command

skyramp generate smoke rest http://api-sample:8000/api/v1/products \
-X POST \
--language python \
--framework pytest \
--runtime docker \
--docker-network api-insight_default \
--docker-skyramp-port 35142 \
--api-schema openapi.json

2.9 Deploy the Skyramp Dashboard

Next to the stdout of the test frameworks, Skyramp offers a simple dashboard to collect and help you analyze your test results. The Skyramp Dashboard is a lightweight Docker image that will automatically be brought up when executing the test. Please specify the --deploy-dashboard flag in the generation command.

Post execution, the dashboard will be available under http://localhost:3000/tests.

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema openapi.json \
--deploy-dashboard

Python

Typescript

1.1 Generate Command

To create a smoke test for an endpoint, specify the endpoint you want to test. In this example, we are using the https://demoshop.skyramp.dev/api/v1/products as the URL to our service. When testing your service, replace it with the URL to the endpoint you want to test.

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
--language python \
--framework pytest \
--api-schema openapi.json

This command generates a smoke test file: products_smoke_test.py.

1.2 Execute Smoke Test

You can execute the generated tests without any additional adjustments to the code. However, based on the application you want to test, you can pass your authentication token to Skyramp Tests via an environment variable.

1.2.1 Set environment variables for authentication (if applicable)

Skyramp’s sample application doesn't require any authentication.

To test against an application that does require authentication, pass your token using an environment variable. By default, Skyramp expects a Bearer Token but we support additional authentication methods, as you can see in the examples below in Section 2.

export SKYRAMP_TEST_TOKEN=$your_auth_token

1.2.2 Run the test

Run the tests using Pytest. If you don’t have Pytest, install it with pip by running the following command in your terminal:

# Prerequisites 
pip install pytest

# Execution of smoke test for products/POST 
python3 -m pytest products_smoke_test.py

1.2.3 Results

We are using Pytest’s default test output in this guide, printing a line for each test that is being run and listing all failures at the end. You can adjust the output behavior following this documentation.

We can see that the test checks 5 methods that all test cases pass.

2. Customize Test Generation

2.1 Generation from Request Data

Instead of using your API spec, Skyramp you can also generate smoke tests based on sample request data. This enables users to quickly generate tests if no API spec is available or test scenarios that depend on specific data.

This requires you to specify the method you want to test.

request.json

{
    "category": "electronics",
    "description": "speaker",
    "image_url": "photo",
    "in_stock": false,
    "name": "boombox",
    "price": 25
}

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--request-data @request.json

2.2 Specification of form parameters for POST request

For POST requests, you can also provide form parameters instead of an API schema or sample request data to define the request body.

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--form-params category=electronics \
--form-params description=speaker \
--form-params image_url=photo \
--form-params in_stock=false \
--form-params name=boombox \
--form-params price=25

2.3 Change the authentication type

By default, Skyramp assumes a Bearer token. You can define the key of your authentication header with the auth-header flag.

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--auth-header X-API-KEY \
--api-schema openapi.json

2.4 Specification of path parameters

Skyramp also allows you to define path param in the generation command. The path-param flag will override all relevant path parameters with your specified value.

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products/{product_id} \
--language python \
--framework pytest \
--path-params product_id=2 \
--api-schema openapi.json

2.5 Specification of query parameters

You can specify query parameters when generating tests for a specific method.

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X GET \
--language python \
--framework pytest \
--query-params limit=5 \
--query-params order=desc \
--api-schema openapi.json

2.6 Specification of test name and directory

If desired, you can override the default test name and specify the directory to save the generated test.

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema openapi.json \
--output post_products_smoke_test.py \
--output-dir skyramp_tests

2.7 Test generation for Robot framework

Next to Pytest, Skyramp also supports the Robotframework in Python. This section shows you how to generate and execute tests using it instead of Pytest.

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework robot \
--api-schema openapi.json

This command generates two files:

  • products_smoke_test.py

  • products_smoke_test.robot(simple Robot wrapper file)

Execute Test

Run the test using the Robotframework. You can reference the generated Python file either in an existing robot file of yours or leverage the simple wrapper file we generate.

# Prerequisites
pip install robotframework

# Execution of smoke test for products/POST 
python3 -m robot products_smoke_test.robot

The results will be outputted following the typical stdout from Robot. You can find more information on the generated outputs in the Robot documentation.

2.8 Change the test execution runtime to Docker

Instead of using “local” execution, Skyramp also supports seamless support for testing applications in your docker network. This allows you to test your services without worrying about network configurations and port mapping while developing locally.

During test execution, we automatically deploy our Skyramp Worker into the specified Docker network and send the requests from within the network.

Generate Command

skyramp generate smoke rest http://api-sample:8000/api/v1/products \
-X POST \
--language python \
--framework pytest \
--runtime docker \
--docker-network api-insight_default \
--docker-skyramp-port 35142 \
--api-schema openapi.json

2.9 Deploy the Skyramp Dashboard

Next to the stdout of the test frameworks, Skyramp offers a simple dashboard to collect and help you analyze your test results. The Skyramp Dashboard is a lightweight Docker image that will automatically be brought up when executing the test. Please specify the --deploy-dashboard flag in the generation command.

Post execution, the dashboard will be available under http://localhost:3000/tests.

Generate Command

skyramp generate smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema openapi.json \
--deploy-dashboard

© 2025 Skyramp, Inc. All rights reserved.

© 2025 Skyramp, Inc. All rights reserved.

© 2025 Skyramp, Inc. All rights reserved.