Generation
Integration Test
Integration Testing
This guide explains how to generate integration tests using the Skyramp CLI. We'll demonstrate using Skyramp’s Demo Shop API, a simple e-commerce API for product and order management. Learn more about the Demo Shop API.
If you haven’t already installed Skyramp, refer to the instructions in the Installation Guide.
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.
Generate an integration test for REST APIs
This section explains how you can use Skyramp to generate integration tests for REST APIs for all methods of an endpoint.
To reliably generate test cases, we require the following input:
An OpenAPI schema (JSON/YAML)
Skyramp generates a test including all available methods of the specified endpoint URL and its direct children. If the parent of the specified endpoint has relevant methods, they will also be included in the generated test.
For example:
When generating for the endpoint
https://demoshop.skyramp.dev/api/v1/products
, Skyramp generates test functions for all methods under/v1/products
and its direct child/v1/products/{product_id}
, but not for the methods under/v1/products/{product_id}/reviews
.When generating for the endpoint
https://demoshop.skyramp.dev/v1/products/{product_id}
, Skyramp will generate test functions for/v1/products/{product_id}
, its direct child/v1/products/{product_id}/reviews
, and its direct parent/v1/products
.

Generate Integration Test for All Methods of an Endpoint
To create an integration test for an endpoint, specify the endpoint you want to test. In this example, we are using the https://demoshop.skyramp.dev/api
as the URL to our service. When testing your service, replace it with the URL to the endpoint you want to test.
You can find the used API specification here.
Integration Testing
This guide explains how to generate integration tests using the Skyramp CLI. We'll demonstrate using Skyramp’s Demo Shop API, a simple e-commerce API for product and order management. Learn more about the Demo Shop API.
If you haven’t already installed Skyramp, refer to the instructions in the Installation Guide.
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.
Generate an integration test for REST APIs
This section explains how you can use Skyramp to generate integration tests for REST APIs for all methods of an endpoint.
To reliably generate test cases, we require the following input:
An OpenAPI schema (JSON/YAML)
Skyramp generates a test including all available methods of the specified endpoint URL and its direct children. If the parent of the specified endpoint has relevant methods, they will also be included in the generated test.
For example:
When generating for the endpoint
https://demoshop.skyramp.dev/api/v1/products
, Skyramp generates test functions for all methods under/v1/products
and its direct child/v1/products/{product_id}
, but not for the methods under/v1/products/{product_id}/reviews
.When generating for the endpoint
https://demoshop.skyramp.dev/v1/products/{product_id}
, Skyramp will generate test functions for/v1/products/{product_id}
, its direct child/v1/products/{product_id}/reviews
, and its direct parent/v1/products
.

Generate Integration Test for All Methods of an Endpoint
To create an integration test for an endpoint, specify the endpoint you want to test. In this example, we are using the https://demoshop.skyramp.dev/api
as the URL to our service. When testing your service, replace it with the URL to the endpoint you want to test.
You can find the used API specification here.
Integration Testing
This guide explains how to generate integration tests using the Skyramp CLI. We'll demonstrate using Skyramp’s Demo Shop API, a simple e-commerce API for product and order management. Learn more about the Demo Shop API.
If you haven’t already installed Skyramp, refer to the instructions in the Installation Guide.
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.
Generate an integration test for REST APIs
This section explains how you can use Skyramp to generate integration tests for REST APIs for all methods of an endpoint.
To reliably generate test cases, we require the following input:
An OpenAPI schema (JSON/YAML)
Skyramp generates a test including all available methods of the specified endpoint URL and its direct children. If the parent of the specified endpoint has relevant methods, they will also be included in the generated test.
For example:
When generating for the endpoint
https://demoshop.skyramp.dev/api/v1/products
, Skyramp generates test functions for all methods under/v1/products
and its direct child/v1/products/{product_id}
, but not for the methods under/v1/products/{product_id}/reviews
.When generating for the endpoint
https://demoshop.skyramp.dev/v1/products/{product_id}
, Skyramp will generate test functions for/v1/products/{product_id}
, its direct child/v1/products/{product_id}/reviews
, and its direct parent/v1/products
.

Generate Integration Test for All Methods of an Endpoint
To create an integration test for an endpoint, specify the endpoint you want to test. In this example, we are using the https://demoshop.skyramp.dev/api
as the URL to our service. When testing your service, replace it with the URL to the endpoint you want to test.
You can find the used API specification here.
Python
Java
Typescript
skyramp generate integration rest https://demoshop.skyramp.dev/api/v1/products \
--language python \
--framework pytest \
--api-schema
This command generates one file:
products_integration_test.py
The content of the generated test is explained here.
Explanation of Command
https://demoshop.skyramp.dev/api/v1/products
: Defines the URL to the endpoint we aim to test.--language
: Specifies the test output language. For integration testing, we currently support Python, Typescript, and Java.--framework
: Specify the test execution framework of choice.--api-schema
: Points to the OpenAPI schema used to generate the test. We also support sample data as an input for integration test generation.NOTE: Several Skyramp test types allow you to specify a method via the flag
-X
. Using this flag for integration tests will still generate a test but will ignore the flag in favor of generating an integration test using all methods.
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.--auth-header
: This flag allows you to specify the key of your authentication header, e.g.--auth-header X-API-KEY
. By default, we assumeBearer.
--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.
Execute the Integration 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.
Set environment variable for authentication (if applicable)
Skyramp’s sample application doesn't require any authentication.
Ensure proper authentication for test execution. 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. 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
Run the test
Run the test using Pytest. If you don’t have Pytest, install it with pip by running the following command in your terminal:
# Prerequisites
pip3 install pytest
# Execution of integration test
python3 -m
Review Test 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.
Successful test
The generated test passes out of the box.

Test failure
For this section, we intentionally changed the POST request body at line 23 to create a failure by changing image_url
to imageUrl
.
# Request Body
products_POST_request_body = r'''{
"category": "string",
"description": "string",
"imageUrl": "string",
"in_stock": false,
"name": "string",
"price": 0,
}'''
This results in a test failure, since the expected status code does not match the response status code. The expected output looks like the following:

Next Steps
Congratulations, you have just generated your first smoke test! To learn more about how to adjust the test file, please go to the Test File Anatomy page.
Related topics
Python
Java
Typescript
skyramp generate integration rest https://demoshop.skyramp.dev/api/v1/products \
--language python \
--framework pytest \
--api-schema
This command generates one file:
products_integration_test.py
The content of the generated test is explained here.
Explanation of Command
https://demoshop.skyramp.dev/api/v1/products
: Defines the URL to the endpoint we aim to test.--language
: Specifies the test output language. For integration testing, we currently support Python, Typescript, and Java.--framework
: Specify the test execution framework of choice.--api-schema
: Points to the OpenAPI schema used to generate the test. We also support sample data as an input for integration test generation.NOTE: Several Skyramp test types allow you to specify a method via the flag
-X
. Using this flag for integration tests will still generate a test but will ignore the flag in favor of generating an integration test using all methods.
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.--auth-header
: This flag allows you to specify the key of your authentication header, e.g.--auth-header X-API-KEY
. By default, we assumeBearer.
--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.
Execute the Integration 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.
Set environment variable for authentication (if applicable)
Skyramp’s sample application doesn't require any authentication.
Ensure proper authentication for test execution. 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. 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
Run the test
Run the test using Pytest. If you don’t have Pytest, install it with pip by running the following command in your terminal:
# Prerequisites
pip3 install pytest
# Execution of integration test
python3 -m
Review Test 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.
Successful test
The generated test passes out of the box.

Test failure
For this section, we intentionally changed the POST request body at line 23 to create a failure by changing image_url
to imageUrl
.
# Request Body
products_POST_request_body = r'''{
"category": "string",
"description": "string",
"imageUrl": "string",
"in_stock": false,
"name": "string",
"price": 0,
}'''
This results in a test failure, since the expected status code does not match the response status code. The expected output looks like the following:

Next Steps
Congratulations, you have just generated your first smoke test! To learn more about how to adjust the test file, please go to the Test File Anatomy page.
Related topics
Python
Java
Typescript
skyramp generate integration rest https://demoshop.skyramp.dev/api/v1/products \
--language python \
--framework pytest \
--api-schema
This command generates one file:
products_integration_test.py
The content of the generated test is explained here.
Explanation of Command
https://demoshop.skyramp.dev/api/v1/products
: Defines the URL to the endpoint we aim to test.--language
: Specifies the test output language. For integration testing, we currently support Python, Typescript, and Java.--framework
: Specify the test execution framework of choice.--api-schema
: Points to the OpenAPI schema used to generate the test. We also support sample data as an input for integration test generation.NOTE: Several Skyramp test types allow you to specify a method via the flag
-X
. Using this flag for integration tests will still generate a test but will ignore the flag in favor of generating an integration test using all methods.
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.--auth-header
: This flag allows you to specify the key of your authentication header, e.g.--auth-header X-API-KEY
. By default, we assumeBearer.
--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.
Execute the Integration 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.
Set environment variable for authentication (if applicable)
Skyramp’s sample application doesn't require any authentication.
Ensure proper authentication for test execution. 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. 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
Run the test
Run the test using Pytest. If you don’t have Pytest, install it with pip by running the following command in your terminal:
# Prerequisites
pip3 install pytest
# Execution of integration test
python3 -m
Review Test 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.
Successful test
The generated test passes out of the box.

Test failure
For this section, we intentionally changed the POST request body at line 23 to create a failure by changing image_url
to imageUrl
.
# Request Body
products_POST_request_body = r'''{
"category": "string",
"description": "string",
"imageUrl": "string",
"in_stock": false,
"name": "string",
"price": 0,
}'''
This results in a test failure, since the expected status code does not match the response status code. The expected output looks like the following:

Next Steps
Congratulations, you have just generated your first smoke test! To learn more about how to adjust the test file, please go to the Test File Anatomy page.