Load Test
Advanced Generation
Test File Anatomy
Overview
This section explains the key elements of the generated test file. This will enable you to make adjustments when needed quickly.
The header of each test file shows when the test was generated and what command was used to generate it.
The body of the test file imports all relevant libraries and specifies the URL for all test requests.
Below, the load test configuration is generated based on the flags specified in the command.
If a trace is used to generate the load test, we generate a single function that includes all API calls in the trace. Otherwise, we generate a function per method tested. A load test function typically consists of:
Invocation of Skyramp Client
Definition of the authentication header
Creation of a Skyramp scenario
The scenario serves as an encapsulation of all relevant requests
For each API function included in the test:
Definition of the request body (based on API schema or sample data)
Formation of the request that can be executed asynchronously
Collection and print statement of the load test results
Test Execution Behavior
The generated load test will execute in the following way:
Any requests being tested will be created and added to an AsyncScenario with their expected status code assertion.
The scenario will then be sent to a worker for execution (based on the Skyramp Client specified) using the load test configuration defined in the generation command.
Unlike other Skyramp test types, load testing is asynchronous. This means every request in the test will be executed without waiting for feedback. This allows for a more accurate simulation of real-time traffic to a system and therefore a more accurate understanding of the stresses a system could face.
The load test configuration impacts the execution behavior in a few ways:
If a load duration is specified rather than a count, the Skyramp worker will try to maximize RPS for the specified duration while collecting latency and failure rate of those requests
If a count is specified rather than a duration, the Skyramp worker will execute that exact count of requests while collecting latency and failure rate.
Other load test configs (rampup, multithreading, target RPS) will impact behavior of the worker during the test as it works towards the desired count or duration
Test File Anatomy
Overview
This section explains the key elements of the generated test file. This will enable you to make adjustments when needed quickly.
The header of each test file shows when the test was generated and what command was used to generate it.
The body of the test file imports all relevant libraries and specifies the URL for all test requests.
Below, the load test configuration is generated based on the flags specified in the command.
If a trace is used to generate the load test, we generate a single function that includes all API calls in the trace. Otherwise, we generate a function per method tested. A load test function typically consists of:
Invocation of Skyramp Client
Definition of the authentication header
Creation of a Skyramp scenario
The scenario serves as an encapsulation of all relevant requests
For each API function included in the test:
Definition of the request body (based on API schema or sample data)
Formation of the request that can be executed asynchronously
Collection and print statement of the load test results
Test Execution Behavior
The generated load test will execute in the following way:
Any requests being tested will be created and added to an AsyncScenario with their expected status code assertion.
The scenario will then be sent to a worker for execution (based on the Skyramp Client specified) using the load test configuration defined in the generation command.
Unlike other Skyramp test types, load testing is asynchronous. This means every request in the test will be executed without waiting for feedback. This allows for a more accurate simulation of real-time traffic to a system and therefore a more accurate understanding of the stresses a system could face.
The load test configuration impacts the execution behavior in a few ways:
If a load duration is specified rather than a count, the Skyramp worker will try to maximize RPS for the specified duration while collecting latency and failure rate of those requests
If a count is specified rather than a duration, the Skyramp worker will execute that exact count of requests while collecting latency and failure rate.
Other load test configs (rampup, multithreading, target RPS) will impact behavior of the worker during the test as it works towards the desired count or duration
Test File Anatomy
Overview
This section explains the key elements of the generated test file. This will enable you to make adjustments when needed quickly.
The header of each test file shows when the test was generated and what command was used to generate it.
The body of the test file imports all relevant libraries and specifies the URL for all test requests.
Below, the load test configuration is generated based on the flags specified in the command.
If a trace is used to generate the load test, we generate a single function that includes all API calls in the trace. Otherwise, we generate a function per method tested. A load test function typically consists of:
Invocation of Skyramp Client
Definition of the authentication header
Creation of a Skyramp scenario
The scenario serves as an encapsulation of all relevant requests
For each API function included in the test:
Definition of the request body (based on API schema or sample data)
Formation of the request that can be executed asynchronously
Collection and print statement of the load test results
Test Execution Behavior
The generated load test will execute in the following way:
Any requests being tested will be created and added to an AsyncScenario with their expected status code assertion.
The scenario will then be sent to a worker for execution (based on the Skyramp Client specified) using the load test configuration defined in the generation command.
Unlike other Skyramp test types, load testing is asynchronous. This means every request in the test will be executed without waiting for feedback. This allows for a more accurate simulation of real-time traffic to a system and therefore a more accurate understanding of the stresses a system could face.
The load test configuration impacts the execution behavior in a few ways:
If a load duration is specified rather than a count, the Skyramp worker will try to maximize RPS for the specified duration while collecting latency and failure rate of those requests
If a count is specified rather than a duration, the Skyramp worker will execute that exact count of requests while collecting latency and failure rate.
Other load test configs (rampup, multithreading, target RPS) will impact behavior of the worker during the test as it works towards the desired count or duration
Python
Java
Single Method Test Generation (POST)
# Generated by Skyramp v0.5.24 on 2025-06-23 19:13:14.605008 -0400 EDT m=+1.210862085
# Command: skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
# --api-schema https://demoshop.skyramp.dev/openapi.json \
# --framework pytest \
# --language python \
# --method POST \
# Import of required libraries
import skyramp
import os
import time
# URL for test requests
URL = "https://demoshop.skyramp.dev"
load_config = skyramp.LoadTestConfig(
load_duration=5,
load_num_threads=1,
load_target_rps=None,
load_count=None,
load_rampup_duration=None,
load_rampup_interval=None
)
def test_products_post(load_test_config:skyramp.LoadTestConfig=load_config):
# Invocation of Skyramp Client
client = skyramp.Client()
# Definition of authentication header
headers = {}
if os.getenv("SKYRAMP_TEST_TOKEN") is not None:
headers["Authorization"] = "Bearer " + os.getenv("SKYRAMP_TEST_TOKEN")
scenario = skyramp.AsyncScenario(name="scenario")
# Request Body
products_POST_request_body = r'''{
"category": "Toys",
"description": "Bear Soft Toy",
"image_url": "https://images.app.goo.gl/cgcHpeehRdu5osot8",
"in_stock": true,
"name": "bigbear",
"price": 9.99
}'''
# Add Request to Scenario
products_POST_response = scenario.add_async_request(
name="products_POST",
url=URL,
path="/api/v1/products",
method="POST",
body=products_POST_request_body,
headers=headers,
expected_code="201"
)
result = client.send_scenario(
scenario,
load_test_config=load_test_config
)
print(
f"result: {result.get_overall_status()}"
)
if __name__ == "__main__":
test_products_post()
Python
Java
Single Method Test Generation (POST)
# Generated by Skyramp v0.5.24 on 2025-06-23 19:13:14.605008 -0400 EDT m=+1.210862085
# Command: skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
# --api-schema https://demoshop.skyramp.dev/openapi.json \
# --framework pytest \
# --language python \
# --method POST \
# Import of required libraries
import skyramp
import os
import time
# URL for test requests
URL = "https://demoshop.skyramp.dev"
load_config = skyramp.LoadTestConfig(
load_duration=5,
load_num_threads=1,
load_target_rps=None,
load_count=None,
load_rampup_duration=None,
load_rampup_interval=None
)
def test_products_post(load_test_config:skyramp.LoadTestConfig=load_config):
# Invocation of Skyramp Client
client = skyramp.Client()
# Definition of authentication header
headers = {}
if os.getenv("SKYRAMP_TEST_TOKEN") is not None:
headers["Authorization"] = "Bearer " + os.getenv("SKYRAMP_TEST_TOKEN")
scenario = skyramp.AsyncScenario(name="scenario")
# Request Body
products_POST_request_body = r'''{
"category": "Toys",
"description": "Bear Soft Toy",
"image_url": "https://images.app.goo.gl/cgcHpeehRdu5osot8",
"in_stock": true,
"name": "bigbear",
"price": 9.99
}'''
# Add Request to Scenario
products_POST_response = scenario.add_async_request(
name="products_POST",
url=URL,
path="/api/v1/products",
method="POST",
body=products_POST_request_body,
headers=headers,
expected_code="201"
)
result = client.send_scenario(
scenario,
load_test_config=load_test_config
)
print(
f"result: {result.get_overall_status()}"
)
if __name__ == "__main__":
test_products_post()
Python
Java
Single Method Test Generation (POST)
# Generated by Skyramp v0.5.24 on 2025-06-23 19:13:14.605008 -0400 EDT m=+1.210862085
# Command: skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
# --api-schema https://demoshop.skyramp.dev/openapi.json \
# --framework pytest \
# --language python \
# --method POST \
# Import of required libraries
import skyramp
import os
import time
# URL for test requests
URL = "https://demoshop.skyramp.dev"
load_config = skyramp.LoadTestConfig(
load_duration=5,
load_num_threads=1,
load_target_rps=None,
load_count=None,
load_rampup_duration=None,
load_rampup_interval=None
)
def test_products_post(load_test_config:skyramp.LoadTestConfig=load_config):
# Invocation of Skyramp Client
client = skyramp.Client()
# Definition of authentication header
headers = {}
if os.getenv("SKYRAMP_TEST_TOKEN") is not None:
headers["Authorization"] = "Bearer " + os.getenv("SKYRAMP_TEST_TOKEN")
scenario = skyramp.AsyncScenario(name="scenario")
# Request Body
products_POST_request_body = r'''{
"category": "Toys",
"description": "Bear Soft Toy",
"image_url": "https://images.app.goo.gl/cgcHpeehRdu5osot8",
"in_stock": true,
"name": "bigbear",
"price": 9.99
}'''
# Add Request to Scenario
products_POST_response = scenario.add_async_request(
name="products_POST",
url=URL,
path="/api/v1/products",
method="POST",
body=products_POST_request_body,
headers=headers,
expected_code="201"
)
result = client.send_scenario(
scenario,
load_test_config=load_test_config
)
print(
f"result: {result.get_overall_status()}"
)
if __name__ == "__main__":
test_products_post()