Load Test
Advanced Generation
Generation Examples
In this section, we will go over how to customize the Skyramp CLI test generation command to achieve specific use cases for your test execution.
Generation Examples
In this section, we will go over how to customize the Skyramp CLI test generation command to achieve specific use cases for your test execution.
Generation Examples
In this section, we will go over how to customize the Skyramp CLI test generation command to achieve specific use cases for your test execution.
Python
Java
Useful General Examples
Generate tests from request data
Skyramp can generate load tests based on sample request data. This enables users to quickly generate tests if no API spec is available or test scenarios depend on specific data.
request.json
{
"category": "electronics",
"description": "speaker",
"image_url": "photo",
"in_stock": false,
"name": "boombox",
"price": 25
Command to generate from sample data
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--request-data
Specify the form parameters for a 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.
Commands to generate load test
skyramp generate load 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
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.
Command to change authentication type
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--auth-header X-API-KEY \
--api-schema
Specify load test path parameters
Skyramp also allows you to define path parameters in the generation command. The path-param
flag will override all relevant path parameters with your specified value.
Command to specify path parameters
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
--language python \
--framework pytest \
--path-params product_id=2 \
--api-schema
Specify query parameters
You can specify query parameters when generating tests for a specific method.
Command to specify query parameters
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X GET \
--language python \
--framework pytest \
--query-params limit=5 \
--query-params order=desc \
--api-schema
Specify load test name and directory
You can override the default test name and specify the directory to save the generated test.
Command to specify test name and directory
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema https://demoshop.skyramp.dev/openapi.json \
--output post_products_load_test.py \
--output-dir
Test generation for Robot framework
Skyramp also supports the Robot framework in Python. This section shows you how to generate and execute tests using Robot.
Load test generate command
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework robot \
--api-schema
This command generates two files:
products_POST_load_test.py
products_POST_load_test.robot
(simple Robot wrapper file)
Execute the load test
Ensure that authentication is properly set up. Run the test using the Robot framework. You can reference the generated Python file either in an existing robot file of yours or leverage the simple wrapper file we generate.
# Prerequisites
pip3 install robotframework
# Execution of load test for products/POST
python3 -m
The results will be outputted following the typical stdout from Robot. You can find more information on the generated outputs in the Robot documentation.
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 load test command for the Skyramp worker
api-sample
is the service alias; replace with your service name
skyramp generate load 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
Deploy the Skyramp Dashboard
Skyramp also 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.
Command to deploy Skyramp Dashboard
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema https://demoshop.skyramp.dev/openapi.json \
--deploy-dashboard
Load Test Configuration Examples
Specify load count
Skyramp can execute a load test scenario as many times as specified by the user with the --default-count
flag. This flag cannot be used in combination with the --default-duration
flag.
Command to generate load test with load count
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema https://demoshop.skyramp.dev/openapi.json \
--default-count 10
Specify load duration
Skyramp can execute a load test scenario as many times as possible in a duration (in seconds) specified by the user with the --default-duration
flag. This flag cannot be used in combination with the --default-count
flag.
Command to generate load test with load count
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema https://demoshop.skyramp.dev/openapi.json \
--default-duration 10
Specify rampup parameters
You can specify conditions around how quickly and often Skyramp should increase load to your system. Use the --default-rampup-interval
to specify how many times to increase the RPS and --default-rampup-duration
to specify how long (in seconds) Skyramp should take to ramp up to the target/maximum RPS.
Command to generate load test with rampup parameters
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema https://demoshop.skyramp.dev/openapi.json \
--default-duration 20
--default-rampup-interval 3
--default-rampup-duration 10
Specify target load
You can specify a target load for the test with --default-target-rps
Command to generate load test with target load
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema https://demoshop.skyramp.dev/openapi.json \
--default-duration 20
--default-rampup-interval 3
--default-rampup-duration 10
--default-target-rps 10
Test Vertical Scalability
You can specify --default-num-threads
to open concurrent threads for your load test. Concurrent threads represent virtual users enabling you to test the vertical scalability of the service.
Command to generate load test with concurrent threads
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema https://demoshop.skyramp.dev/openapi.json \
--default-duration 20
--default-num-threads 3
Test Generation from Skyramp Trace
For these examples, please ensure you have the following file saved in your local directory: backend_test_trace.json.
Recap: Using Fully Qualified Domain Names (FQDNs)
Skyramp provides special flags related to filtering certain FQDNs from traces to focus your load test generation on the most critical flows.
FQDNs need to be specified either as an exact path to the endpoint or in combination with a wildcard. For example:
demoshop.skyramp.dev/products
will only filter for POST and GET of the products endpoint.demoshop.skyramp.dev/products*
will filter for all products endpoints + any nested endpoints.demoshop.skyramp.dev/products/*
will filter only for any nested endpoints that require a product ID. It will not generate requests for POST and GET products.
For endpoints that require path parameters, please replace the path parameter with the wildcard:
Convert
demoshop.skyramp.dev/products/{product_id}/reviews
todemoshop.skyramp.dev/products/*/reviews
Include certain FQDNs from the trace in the test
If you are only looking to test specific requests collected in your trace, you can filter for those FQDNs using the --include
flag.
Command to generate with included FQDNs
skyramp generate load rest \
--language python \
--framework pytest \
--trace backend_test_trace.json \
--include
Exclude certain FQDNs from the trace in the test
If your trace collected requests that are irrelevant to your load test, you can exclude those FQDNs using the --exclude
flag.
Command to generate with excluded FQDNs
skyramp generate load rest \
--language python \
--framework pytest \
--trace backend_test_trace.json \
--exclude
Python
Java
Useful General Examples
Generate tests from request data
Skyramp can generate load tests based on sample request data. This enables users to quickly generate tests if no API spec is available or test scenarios depend on specific data.
request.json
{
"category": "electronics",
"description": "speaker",
"image_url": "photo",
"in_stock": false,
"name": "boombox",
"price": 25
Command to generate from sample data
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--request-data
Specify the form parameters for a 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.
Commands to generate load test
skyramp generate load 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
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.
Command to change authentication type
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--auth-header X-API-KEY \
--api-schema
Specify load test path parameters
Skyramp also allows you to define path parameters in the generation command. The path-param
flag will override all relevant path parameters with your specified value.
Command to specify path parameters
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
--language python \
--framework pytest \
--path-params product_id=2 \
--api-schema
Specify query parameters
You can specify query parameters when generating tests for a specific method.
Command to specify query parameters
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X GET \
--language python \
--framework pytest \
--query-params limit=5 \
--query-params order=desc \
--api-schema
Specify load test name and directory
You can override the default test name and specify the directory to save the generated test.
Command to specify test name and directory
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema https://demoshop.skyramp.dev/openapi.json \
--output post_products_load_test.py \
--output-dir
Test generation for Robot framework
Skyramp also supports the Robot framework in Python. This section shows you how to generate and execute tests using Robot.
Load test generate command
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework robot \
--api-schema
This command generates two files:
products_POST_load_test.py
products_POST_load_test.robot
(simple Robot wrapper file)
Execute the load test
Ensure that authentication is properly set up. Run the test using the Robot framework. You can reference the generated Python file either in an existing robot file of yours or leverage the simple wrapper file we generate.
# Prerequisites
pip3 install robotframework
# Execution of load test for products/POST
python3 -m
The results will be outputted following the typical stdout from Robot. You can find more information on the generated outputs in the Robot documentation.
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 load test command for the Skyramp worker
api-sample
is the service alias; replace with your service name
skyramp generate load 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
Deploy the Skyramp Dashboard
Skyramp also 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.
Command to deploy Skyramp Dashboard
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema https://demoshop.skyramp.dev/openapi.json \
--deploy-dashboard
Load Test Configuration Examples
Specify load count
Skyramp can execute a load test scenario as many times as specified by the user with the --default-count
flag. This flag cannot be used in combination with the --default-duration
flag.
Command to generate load test with load count
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema https://demoshop.skyramp.dev/openapi.json \
--default-count 10
Specify load duration
Skyramp can execute a load test scenario as many times as possible in a duration (in seconds) specified by the user with the --default-duration
flag. This flag cannot be used in combination with the --default-count
flag.
Command to generate load test with load count
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema https://demoshop.skyramp.dev/openapi.json \
--default-duration 10
Specify rampup parameters
You can specify conditions around how quickly and often Skyramp should increase load to your system. Use the --default-rampup-interval
to specify how many times to increase the RPS and --default-rampup-duration
to specify how long (in seconds) Skyramp should take to ramp up to the target/maximum RPS.
Command to generate load test with rampup parameters
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema https://demoshop.skyramp.dev/openapi.json \
--default-duration 20
--default-rampup-interval 3
--default-rampup-duration 10
Specify target load
You can specify a target load for the test with --default-target-rps
Command to generate load test with target load
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema https://demoshop.skyramp.dev/openapi.json \
--default-duration 20
--default-rampup-interval 3
--default-rampup-duration 10
--default-target-rps 10
Test Vertical Scalability
You can specify --default-num-threads
to open concurrent threads for your load test. Concurrent threads represent virtual users enabling you to test the vertical scalability of the service.
Command to generate load test with concurrent threads
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema https://demoshop.skyramp.dev/openapi.json \
--default-duration 20
--default-num-threads 3
Test Generation from Skyramp Trace
For these examples, please ensure you have the following file saved in your local directory: backend_test_trace.json.
Recap: Using Fully Qualified Domain Names (FQDNs)
Skyramp provides special flags related to filtering certain FQDNs from traces to focus your load test generation on the most critical flows.
FQDNs need to be specified either as an exact path to the endpoint or in combination with a wildcard. For example:
demoshop.skyramp.dev/products
will only filter for POST and GET of the products endpoint.demoshop.skyramp.dev/products*
will filter for all products endpoints + any nested endpoints.demoshop.skyramp.dev/products/*
will filter only for any nested endpoints that require a product ID. It will not generate requests for POST and GET products.
For endpoints that require path parameters, please replace the path parameter with the wildcard:
Convert
demoshop.skyramp.dev/products/{product_id}/reviews
todemoshop.skyramp.dev/products/*/reviews
Include certain FQDNs from the trace in the test
If you are only looking to test specific requests collected in your trace, you can filter for those FQDNs using the --include
flag.
Command to generate with included FQDNs
skyramp generate load rest \
--language python \
--framework pytest \
--trace backend_test_trace.json \
--include
Exclude certain FQDNs from the trace in the test
If your trace collected requests that are irrelevant to your load test, you can exclude those FQDNs using the --exclude
flag.
Command to generate with excluded FQDNs
skyramp generate load rest \
--language python \
--framework pytest \
--trace backend_test_trace.json \
--exclude
Python
Java
Useful General Examples
Generate tests from request data
Skyramp can generate load tests based on sample request data. This enables users to quickly generate tests if no API spec is available or test scenarios depend on specific data.
request.json
{
"category": "electronics",
"description": "speaker",
"image_url": "photo",
"in_stock": false,
"name": "boombox",
"price": 25
Command to generate from sample data
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--request-data
Specify the form parameters for a 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.
Commands to generate load test
skyramp generate load 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
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.
Command to change authentication type
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--auth-header X-API-KEY \
--api-schema
Specify load test path parameters
Skyramp also allows you to define path parameters in the generation command. The path-param
flag will override all relevant path parameters with your specified value.
Command to specify path parameters
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
--language python \
--framework pytest \
--path-params product_id=2 \
--api-schema
Specify query parameters
You can specify query parameters when generating tests for a specific method.
Command to specify query parameters
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X GET \
--language python \
--framework pytest \
--query-params limit=5 \
--query-params order=desc \
--api-schema
Specify load test name and directory
You can override the default test name and specify the directory to save the generated test.
Command to specify test name and directory
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema https://demoshop.skyramp.dev/openapi.json \
--output post_products_load_test.py \
--output-dir
Test generation for Robot framework
Skyramp also supports the Robot framework in Python. This section shows you how to generate and execute tests using Robot.
Load test generate command
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework robot \
--api-schema
This command generates two files:
products_POST_load_test.py
products_POST_load_test.robot
(simple Robot wrapper file)
Execute the load test
Ensure that authentication is properly set up. Run the test using the Robot framework. You can reference the generated Python file either in an existing robot file of yours or leverage the simple wrapper file we generate.
# Prerequisites
pip3 install robotframework
# Execution of load test for products/POST
python3 -m
The results will be outputted following the typical stdout from Robot. You can find more information on the generated outputs in the Robot documentation.
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 load test command for the Skyramp worker
api-sample
is the service alias; replace with your service name
skyramp generate load 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
Deploy the Skyramp Dashboard
Skyramp also 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.
Command to deploy Skyramp Dashboard
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema https://demoshop.skyramp.dev/openapi.json \
--deploy-dashboard
Load Test Configuration Examples
Specify load count
Skyramp can execute a load test scenario as many times as specified by the user with the --default-count
flag. This flag cannot be used in combination with the --default-duration
flag.
Command to generate load test with load count
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema https://demoshop.skyramp.dev/openapi.json \
--default-count 10
Specify load duration
Skyramp can execute a load test scenario as many times as possible in a duration (in seconds) specified by the user with the --default-duration
flag. This flag cannot be used in combination with the --default-count
flag.
Command to generate load test with load count
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema https://demoshop.skyramp.dev/openapi.json \
--default-duration 10
Specify rampup parameters
You can specify conditions around how quickly and often Skyramp should increase load to your system. Use the --default-rampup-interval
to specify how many times to increase the RPS and --default-rampup-duration
to specify how long (in seconds) Skyramp should take to ramp up to the target/maximum RPS.
Command to generate load test with rampup parameters
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema https://demoshop.skyramp.dev/openapi.json \
--default-duration 20
--default-rampup-interval 3
--default-rampup-duration 10
Specify target load
You can specify a target load for the test with --default-target-rps
Command to generate load test with target load
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema https://demoshop.skyramp.dev/openapi.json \
--default-duration 20
--default-rampup-interval 3
--default-rampup-duration 10
--default-target-rps 10
Test Vertical Scalability
You can specify --default-num-threads
to open concurrent threads for your load test. Concurrent threads represent virtual users enabling you to test the vertical scalability of the service.
Command to generate load test with concurrent threads
skyramp generate load rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema https://demoshop.skyramp.dev/openapi.json \
--default-duration 20
--default-num-threads 3
Test Generation from Skyramp Trace
For these examples, please ensure you have the following file saved in your local directory: backend_test_trace.json.
Recap: Using Fully Qualified Domain Names (FQDNs)
Skyramp provides special flags related to filtering certain FQDNs from traces to focus your load test generation on the most critical flows.
FQDNs need to be specified either as an exact path to the endpoint or in combination with a wildcard. For example:
demoshop.skyramp.dev/products
will only filter for POST and GET of the products endpoint.demoshop.skyramp.dev/products*
will filter for all products endpoints + any nested endpoints.demoshop.skyramp.dev/products/*
will filter only for any nested endpoints that require a product ID. It will not generate requests for POST and GET products.
For endpoints that require path parameters, please replace the path parameter with the wildcard:
Convert
demoshop.skyramp.dev/products/{product_id}/reviews
todemoshop.skyramp.dev/products/*/reviews
Include certain FQDNs from the trace in the test
If you are only looking to test specific requests collected in your trace, you can filter for those FQDNs using the --include
flag.
Command to generate with included FQDNs
skyramp generate load rest \
--language python \
--framework pytest \
--trace backend_test_trace.json \
--include
Exclude certain FQDNs from the trace in the test
If your trace collected requests that are irrelevant to your load test, you can exclude those FQDNs using the --exclude
flag.
Command to generate with excluded FQDNs
skyramp generate load rest \
--language python \
--framework pytest \
--trace backend_test_trace.json \
--exclude