Generation

Smoke Test

Smoke Testing

This guide explains how to generate smoke tests using Skyramp's CLI, ensuring your REST API endpoints respond correctly. 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

Smoke testing is a preliminary check used to verify that an endpoint is accessible and returns a valid response. Smoke tests are useful for quickly identifying critical defects after significant changes.

Generate a smoke test for REST APIs

This section explains how you can use Skyramp to generate a smoke test for a specific method of a REST API. To reliably generate test cases, we require at least one of the following inputs:

  • An OpenAPI schema file (JSON/YAML)

  • Sample request data (JSON blob or JSON file)

In this guide, we'll use the OpenAPI schema approach. If you want more control over the generated body values, you can also do test generation from sample data.

Generate Smoke Test for a Single Method

To create a smoke test for a single method, specify the method you want to test against in the command. 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.

Smoke Testing

This guide explains how to generate smoke tests using Skyramp's CLI, ensuring your REST API endpoints respond correctly. 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

Smoke testing is a preliminary check used to verify that an endpoint is accessible and returns a valid response. Smoke tests are useful for quickly identifying critical defects after significant changes.

Generate a smoke test for REST APIs

This section explains how you can use Skyramp to generate a smoke test for a specific method of a REST API. To reliably generate test cases, we require at least one of the following inputs:

  • An OpenAPI schema file (JSON/YAML)

  • Sample request data (JSON blob or JSON file)

In this guide, we'll use the OpenAPI schema approach. If you want more control over the generated body values, you can also do test generation from sample data.

Generate Smoke Test for a Single Method

To create a smoke test for a single method, specify the method you want to test against in the command. 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.

Smoke Testing

This guide explains how to generate smoke tests using Skyramp's CLI, ensuring your REST API endpoints respond correctly. 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

Smoke testing is a preliminary check used to verify that an endpoint is accessible and returns a valid response. Smoke tests are useful for quickly identifying critical defects after significant changes.

Generate a smoke test for REST APIs

This section explains how you can use Skyramp to generate a smoke test for a specific method of a REST API. To reliably generate test cases, we require at least one of the following inputs:

  • An OpenAPI schema file (JSON/YAML)

  • Sample request data (JSON blob or JSON file)

In this guide, we'll use the OpenAPI schema approach. If you want more control over the generated body values, you can also do test generation from sample data.

Generate Smoke Test for a Single Method

To create a smoke test for a single method, specify the method you want to test against in the command. 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 smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema

This command generates one file:

  • products_POST_smoke_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.

  • -X: Specifies the API method to test.

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

  • --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 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 smoke test for products/POST 
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

Using the single POST method example with the /v1/products endpoint, the test passes.

Test failure

To confirm that the test is functioning correctly, let’s make it fail. For this section, we intentionally changed the expected status code from 201 to 400.

To confirm that the test is functioning correctly, let’s make it fail. For this section, we intentionally changed the expected status code from 20X to 40X in the products_POST_smoke_test.py test file (line 43).

assert products_POST_response.status_code == 400

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 smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema

This command generates one file:

  • products_POST_smoke_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.

  • -X: Specifies the API method to test.

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

  • --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 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 smoke test for products/POST 
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

Using the single POST method example with the /v1/products endpoint, the test passes.

Test failure

To confirm that the test is functioning correctly, let’s make it fail. For this section, we intentionally changed the expected status code from 201 to 400.

To confirm that the test is functioning correctly, let’s make it fail. For this section, we intentionally changed the expected status code from 20X to 40X in the products_POST_smoke_test.py test file (line 43).

assert products_POST_response.status_code == 400

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 smoke rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema

This command generates one file:

  • products_POST_smoke_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.

  • -X: Specifies the API method to test.

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

  • --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 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 smoke test for products/POST 
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

Using the single POST method example with the /v1/products endpoint, the test passes.

Test failure

To confirm that the test is functioning correctly, let’s make it fail. For this section, we intentionally changed the expected status code from 201 to 400.

To confirm that the test is functioning correctly, let’s make it fail. For this section, we intentionally changed the expected status code from 20X to 40X in the products_POST_smoke_test.py test file (line 43).

assert products_POST_response.status_code == 400

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

© 2025 Skyramp, Inc. All rights reserved.

© 2025 Skyramp, Inc. All rights reserved.

© 2025 Skyramp, Inc. All rights reserved.