API Reference
This section provides detailed documentation of the Stressify.jl API.
Functions
- options(; vus::Int=1, format::String="default", ramp_duration::Union{Float64, Nothing}=nothing, max_vus::Union{Int, Nothing}=nothing, iterations::Union{Int, Nothing}=nothing, duration::Union{Float64, Nothing}=nothing, noDebug::Bool=false)
Determine the test configuration options, such as the number of virtual users (VUs), format, ramp duration, maximum VUs, iterations, and duration.
- Parameters:
vus – The number of virtual users to simulate.
format – The format of the test execution “vus-ramping”.
ramp_duration – The duration of the ramp-up period.
max_vus – The maximum number of virtual users to simulate.
iterations – The number of iterations to run. Don`t use with format “vus-ramping”.
duration – The duration of the test in seconds.
noDebug – Disable debug mode.
- run_test(requests::Vararg{NamedTuple}
Run a performance test using the specified configuration.
- Parameters:
requests – A list of named tuples representing the test configuration.
Support HTTP methods
- http_get(endpoint::String; headers::Dict)
Send an HTTP GET request to the specified endpoint.
- Parameters:
endpoint – The API endpoint to test.
headers – A dictionary of headers to include in the request.
- Returns:
A dictionary containing the test results.
- http_post(endpoint::String; payload::String, headers::Dict)
Send an HTTP POST request to the specified endpoint.
- Parameters:
endpoint – The API endpoint to test.
payload – The JSON payload to send with the request.
headers – A dictionary of headers to include in the request.
- Returns:
A dictionary containing the test results.
- http_put(endpoint::String; payload::String, headers::Dict)
Send an HTTP PUT request to the specified endpoint.
- Parameters:
endpoint – The API endpoint to test.
payload – The JSON payload to send with the request.
headers – A dictionary of headers to include in the request.
- Returns:
A dictionary containing the test results.
- http_delete(endpoint::String; headers::Dict)
Send an HTTP DELETE request to the specified endpoint.
- Parameters:
endpoint – The API endpoint to test.
headers – A dictionary of headers to include in the request.
- Returns:
A dictionary containing the test results.
- http_patch(endpoint::String; payload::String, headers::Dict)
Send an HTTP PATCH request to the specified endpoint.
- Parameters:
endpoint – The API endpoint to test.
payload – The JSON payload to send with the request.
headers – A dictionary of headers to include in the request.
- Returns:
A dictionary containing the test results.
Report Generation
- generate_report(results::Dict)
Generate a detailed report from test results.
- Parameters:
results – The results dictionary from a test run.
- Returns:
A JSON string representing the report.
- save_results_to_json(results::Dict, filepath::String)
Save the test results to a JSON file.
- Parameters:
results – The results dictionary from a test run.
filepath – The path to the output file.
Data Utils
- random_csv_row(file_path::String)
Get a random row from a CSV file.
- Parameters:
file_path – The path to the CSV file.
- Returns:
A dictionary representing a row from the CSV file.
- random_json_row(file_path::String)
Get a random row from a JSON file.
- Parameters:
file_path – The path to the JSON file.
- Returns:
A dictionary representing a row from the JSON file.