Fuzz Test
Examples
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
Specification of sample request data
Instead of using your API spec, Skyramp you can also generate fuzz tests based on sample request data. This enables users to quickly generate tests if no API spec is available or test scenarios that depend on specific data.
This requires you to specify the method you want to test.
request.json
{
"category": "electronics",
"description": "speaker",
"image_url": "photo",
"in_stock": false,
"name": "boombox",
"price": 25
Command to generate test with sample request data
skyramp generate fuzz rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--request-data
Specification of form parameters
For POST requests, you can also provide form parameters instead of an API schema or sample request data to define the request body.
Command to specify form parameters
skyramp generate fuzz 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 set authentication
skyramp generate fuzz rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--auth-header X-API-KEY \
--api-schema
Specification of path parameters
Skyramp also allows you to define path param 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 fuzz rest https://demoshop.skyramp.dev/api/v1/products/{product_id} \
--language python \
--framework pytest \
--path-params product_id=2 \
--api-schema
Specification of query parameters
You can specify query parameters when generating tests for a specific method.
Command to specify query parameters
skyramp generate fuzz rest https://demoshop.skyramp.dev/api/v1/products \
-X GET \
--language python \
--framework pytest \
--query-params limit=5 \
--query-params order=desc \
--api-schema
Specification of test name and directory
If desired, you can override the default test name and specify the directory to save the generated test.
Command to update test file name and directory
skyramp generate fuzz rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema openapi.json \
--output post_products_fuzz_test.py \
--output-dir
Test generation for Robot framework
Next to Pytest, Skyramp also supports the Robot framework in Python. This section shows you how to generate and execute tests using it instead of Pytest.
Command to generate test with Robot
skyramp generate fuzz rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework robot \
--api-schema
This command generates two files:
products_POST_fuzz_test.py
products_POST_fuzz_test.robot
(simple Robot wrapper file)
Execute Test
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 fuzz 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.
Command to run test in Docker
skyramp generate fuzz 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
Next to the stdout of the test frameworks, Skyramp 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 fuzz rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema openapi.json \
--deploy-dashboard
Python
Specification of sample request data
Instead of using your API spec, Skyramp you can also generate fuzz tests based on sample request data. This enables users to quickly generate tests if no API spec is available or test scenarios that depend on specific data.
This requires you to specify the method you want to test.
request.json
{
"category": "electronics",
"description": "speaker",
"image_url": "photo",
"in_stock": false,
"name": "boombox",
"price": 25
Command to generate test with sample request data
skyramp generate fuzz rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--request-data
Specification of form parameters
For POST requests, you can also provide form parameters instead of an API schema or sample request data to define the request body.
Command to specify form parameters
skyramp generate fuzz 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 set authentication
skyramp generate fuzz rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--auth-header X-API-KEY \
--api-schema
Specification of path parameters
Skyramp also allows you to define path param 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 fuzz rest https://demoshop.skyramp.dev/api/v1/products/{product_id} \
--language python \
--framework pytest \
--path-params product_id=2 \
--api-schema
Specification of query parameters
You can specify query parameters when generating tests for a specific method.
Command to specify query parameters
skyramp generate fuzz rest https://demoshop.skyramp.dev/api/v1/products \
-X GET \
--language python \
--framework pytest \
--query-params limit=5 \
--query-params order=desc \
--api-schema
Specification of test name and directory
If desired, you can override the default test name and specify the directory to save the generated test.
Command to update test file name and directory
skyramp generate fuzz rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema openapi.json \
--output post_products_fuzz_test.py \
--output-dir
Test generation for Robot framework
Next to Pytest, Skyramp also supports the Robot framework in Python. This section shows you how to generate and execute tests using it instead of Pytest.
Command to generate test with Robot
skyramp generate fuzz rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework robot \
--api-schema
This command generates two files:
products_POST_fuzz_test.py
products_POST_fuzz_test.robot
(simple Robot wrapper file)
Execute Test
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 fuzz 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.
Command to run test in Docker
skyramp generate fuzz 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
Next to the stdout of the test frameworks, Skyramp 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 fuzz rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema openapi.json \
--deploy-dashboard
Python
Specification of sample request data
Instead of using your API spec, Skyramp you can also generate fuzz tests based on sample request data. This enables users to quickly generate tests if no API spec is available or test scenarios that depend on specific data.
This requires you to specify the method you want to test.
request.json
{
"category": "electronics",
"description": "speaker",
"image_url": "photo",
"in_stock": false,
"name": "boombox",
"price": 25
Command to generate test with sample request data
skyramp generate fuzz rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--request-data
Specification of form parameters
For POST requests, you can also provide form parameters instead of an API schema or sample request data to define the request body.
Command to specify form parameters
skyramp generate fuzz 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 set authentication
skyramp generate fuzz rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--auth-header X-API-KEY \
--api-schema
Specification of path parameters
Skyramp also allows you to define path param 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 fuzz rest https://demoshop.skyramp.dev/api/v1/products/{product_id} \
--language python \
--framework pytest \
--path-params product_id=2 \
--api-schema
Specification of query parameters
You can specify query parameters when generating tests for a specific method.
Command to specify query parameters
skyramp generate fuzz rest https://demoshop.skyramp.dev/api/v1/products \
-X GET \
--language python \
--framework pytest \
--query-params limit=5 \
--query-params order=desc \
--api-schema
Specification of test name and directory
If desired, you can override the default test name and specify the directory to save the generated test.
Command to update test file name and directory
skyramp generate fuzz rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema openapi.json \
--output post_products_fuzz_test.py \
--output-dir
Test generation for Robot framework
Next to Pytest, Skyramp also supports the Robot framework in Python. This section shows you how to generate and execute tests using it instead of Pytest.
Command to generate test with Robot
skyramp generate fuzz rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework robot \
--api-schema
This command generates two files:
products_POST_fuzz_test.py
products_POST_fuzz_test.robot
(simple Robot wrapper file)
Execute Test
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 fuzz 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.
Command to run test in Docker
skyramp generate fuzz 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
Next to the stdout of the test frameworks, Skyramp 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 fuzz rest https://demoshop.skyramp.dev/api/v1/products \
-X POST \
--language python \
--framework pytest \
--api-schema openapi.json \
--deploy-dashboard