Smoke Test

Advanced Generation

Advanced Smoke Testing Generation

You can adjust Skyramp’s generation command to generate smoke tests that fit your needs.

Generate smoke tests for all methods of an endpoint

This section explains how to change the CLI command to generate a smoke test for an entire REST API endpoint. To reliably generate test cases, we require:

  • OpenAPI schema (JSON or YAML file)

Skyramp generates test cases for 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.

NOTE: Skyramp does not guarantee order of execution of API requests when executing smoke tests for all methods of an endpoint, nor does it automatically create any dependencies required for a successful API response for a smoke test (ex. to DELETE a product, you need the product to exist first via POST). This means when you generate the test file, some test cases may not immediately pass, and you will need to update the generated test code accordingly.

If you are looking to generate a test which guarantees order and addresses dependencies for successful API responses, please refer to the Integration Testing guide.

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 Smoke Test for All Methods of an Endpoint

To create smoke tests for all methods of 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.

Advanced Smoke Testing Generation

You can adjust Skyramp’s generation command to generate smoke tests that fit your needs.

Generate smoke tests for all methods of an endpoint

This section explains how to change the CLI command to generate a smoke test for an entire REST API endpoint. To reliably generate test cases, we require:

  • OpenAPI schema (JSON or YAML file)

Skyramp generates test cases for 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.

NOTE: Skyramp does not guarantee order of execution of API requests when executing smoke tests for all methods of an endpoint, nor does it automatically create any dependencies required for a successful API response for a smoke test (ex. to DELETE a product, you need the product to exist first via POST). This means when you generate the test file, some test cases may not immediately pass, and you will need to update the generated test code accordingly.

If you are looking to generate a test which guarantees order and addresses dependencies for successful API responses, please refer to the Integration Testing guide.

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 Smoke Test for All Methods of an Endpoint

To create smoke tests for all methods of 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.

Advanced Smoke Testing Generation

You can adjust Skyramp’s generation command to generate smoke tests that fit your needs.

Generate smoke tests for all methods of an endpoint

This section explains how to change the CLI command to generate a smoke test for an entire REST API endpoint. To reliably generate test cases, we require:

  • OpenAPI schema (JSON or YAML file)

Skyramp generates test cases for 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.

NOTE: Skyramp does not guarantee order of execution of API requests when executing smoke tests for all methods of an endpoint, nor does it automatically create any dependencies required for a successful API response for a smoke test (ex. to DELETE a product, you need the product to exist first via POST). This means when you generate the test file, some test cases may not immediately pass, and you will need to update the generated test code accordingly.

If you are looking to generate a test which guarantees order and addresses dependencies for successful API responses, please refer to the Integration Testing guide.

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 Smoke Test for All Methods of an Endpoint

To create smoke tests for all methods of 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.

Python

Java

Typescript

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

This command generates one file:

  • products_smoke_test.py.

Explanation of Command

  • https://demoshop.skyramp.dev/api/v1/products: Defines the URL to the endpoint we aim to test.

  • NOTE: No API method is specified in this generation command. When paired with an OpenAPI spec, Skyramp will generate tests for all endpoints at the URL, its direct parent (if any), and its direct children.

  • --language: Specifies the test output language. For smoke 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 smoke test generation.

Adjustments

These flags will help you tune the basic smoke test. Additional flags are explained here.

  • --response-status-code: Specify the expected status code. By default, Skyramp either asserts against the defined status code in the API specification or defaults to 20X.

  • --output: Specify the name of the generated test file. Useful if you need it to meet a certain format.

  • --output-dir: Specify the directory to store the generated test file in.

Execute the 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.

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 tests 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 smoke test for products/POST 
python3 -m

Review Test Results

We are using Pytest’s shortened traceback output (--tb=short) 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.

Test failure

We can see that the test checks 5 methods that only 2 test cases pass. This is because the failing endpoints are attempting to read/update/delete a product ID 0 that does not exist in the application’s database.

Successful test

To make this smoke test succeed, you will need to update the expected response of each of the failing test cases.

  • test_products_product_id_get - update line 89 to assert a 404, since the product ID cannot be found

assert products_product_id_GET_response.status_code == 404
  • test_products_product_id_put - update line 120 to assert a 404, since the product ID cannot be found

assert products_product_id_PUT_response.status_code == 404
  • test_products_product_id_delete - update line 140 to assert a 404, since the product ID cannot be found

assert products_product_id_DELETE_response.status_code == 404

Now, if you re-run the test, all 5 test cases will pass:

Next Steps

Congratulations! You have successfully generated a full suite of smoke tests for a REST endpoint. You can adjust the expected status code directly in the output file (see Test File Anatomy for an example with a single method).

Related topics

Python

Java

Typescript

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

This command generates one file:

  • products_smoke_test.py.

Explanation of Command

  • https://demoshop.skyramp.dev/api/v1/products: Defines the URL to the endpoint we aim to test.

  • NOTE: No API method is specified in this generation command. When paired with an OpenAPI spec, Skyramp will generate tests for all endpoints at the URL, its direct parent (if any), and its direct children.

  • --language: Specifies the test output language. For smoke 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 smoke test generation.

Adjustments

These flags will help you tune the basic smoke test. Additional flags are explained here.

  • --response-status-code: Specify the expected status code. By default, Skyramp either asserts against the defined status code in the API specification or defaults to 20X.

  • --output: Specify the name of the generated test file. Useful if you need it to meet a certain format.

  • --output-dir: Specify the directory to store the generated test file in.

Execute the 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.

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 tests 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 smoke test for products/POST 
python3 -m

Review Test Results

We are using Pytest’s shortened traceback output (--tb=short) 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.

Test failure

We can see that the test checks 5 methods that only 2 test cases pass. This is because the failing endpoints are attempting to read/update/delete a product ID 0 that does not exist in the application’s database.

Successful test

To make this smoke test succeed, you will need to update the expected response of each of the failing test cases.

  • test_products_product_id_get - update line 89 to assert a 404, since the product ID cannot be found

assert products_product_id_GET_response.status_code == 404
  • test_products_product_id_put - update line 120 to assert a 404, since the product ID cannot be found

assert products_product_id_PUT_response.status_code == 404
  • test_products_product_id_delete - update line 140 to assert a 404, since the product ID cannot be found

assert products_product_id_DELETE_response.status_code == 404

Now, if you re-run the test, all 5 test cases will pass:

Next Steps

Congratulations! You have successfully generated a full suite of smoke tests for a REST endpoint. You can adjust the expected status code directly in the output file (see Test File Anatomy for an example with a single method).

Related topics

Python

Java

Typescript

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

This command generates one file:

  • products_smoke_test.py.

Explanation of Command

  • https://demoshop.skyramp.dev/api/v1/products: Defines the URL to the endpoint we aim to test.

  • NOTE: No API method is specified in this generation command. When paired with an OpenAPI spec, Skyramp will generate tests for all endpoints at the URL, its direct parent (if any), and its direct children.

  • --language: Specifies the test output language. For smoke 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 smoke test generation.

Adjustments

These flags will help you tune the basic smoke test. Additional flags are explained here.

  • --response-status-code: Specify the expected status code. By default, Skyramp either asserts against the defined status code in the API specification or defaults to 20X.

  • --output: Specify the name of the generated test file. Useful if you need it to meet a certain format.

  • --output-dir: Specify the directory to store the generated test file in.

Execute the 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.

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 tests 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 smoke test for products/POST 
python3 -m

Review Test Results

We are using Pytest’s shortened traceback output (--tb=short) 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.

Test failure

We can see that the test checks 5 methods that only 2 test cases pass. This is because the failing endpoints are attempting to read/update/delete a product ID 0 that does not exist in the application’s database.

Successful test

To make this smoke test succeed, you will need to update the expected response of each of the failing test cases.

  • test_products_product_id_get - update line 89 to assert a 404, since the product ID cannot be found

assert products_product_id_GET_response.status_code == 404
  • test_products_product_id_put - update line 120 to assert a 404, since the product ID cannot be found

assert products_product_id_PUT_response.status_code == 404
  • test_products_product_id_delete - update line 140 to assert a 404, since the product ID cannot be found

assert products_product_id_DELETE_response.status_code == 404

Now, if you re-run the test, all 5 test cases will pass:

Next Steps

Congratulations! You have successfully generated a full suite of smoke tests for a REST endpoint. You can adjust the expected status code directly in the output file (see Test File Anatomy for an example with a single method).

Related topics

© 2025 Skyramp, Inc. All rights reserved.

© 2025 Skyramp, Inc. All rights reserved.

© 2025 Skyramp, Inc. All rights reserved.