90 lines
2.3 KiB
JSON
90 lines
2.3 KiB
JSON
{
|
|
"_comment": "Example API specification for load testing with k6, Gatling, or Artillery.",
|
|
"api_name": "Example API",
|
|
"description": "A simple API endpoint for demonstrating load testing configurations.",
|
|
"endpoints": [
|
|
{
|
|
"name": "Get User",
|
|
"method": "GET",
|
|
"url": "https://example.com/api/users/123",
|
|
"_comment": "Example URL. Replace with your actual API endpoint.",
|
|
"headers": {
|
|
"Content-Type": "application/json",
|
|
"Authorization": "Bearer <your_api_key>"
|
|
},
|
|
"body": null,
|
|
"expected_status_code": 200,
|
|
"assertions": [
|
|
{
|
|
"type": "json_path",
|
|
"path": "$.id",
|
|
"operator": "eq",
|
|
"value": 123,
|
|
"_comment": "Verify user ID is 123."
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Create User",
|
|
"method": "POST",
|
|
"url": "https://example.com/api/users",
|
|
"headers": {
|
|
"Content-Type": "application/json"
|
|
},
|
|
"body": {
|
|
"name": "John Doe",
|
|
"email": "john.doe@example.com"
|
|
},
|
|
"expected_status_code": 201,
|
|
"assertions": [
|
|
{
|
|
"type": "json_path",
|
|
"path": "$.name",
|
|
"operator": "eq",
|
|
"value": "John Doe",
|
|
"_comment": "Verify user name is John Doe."
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Update User",
|
|
"method": "PUT",
|
|
"url": "https://example.com/api/users/123",
|
|
"headers": {
|
|
"Content-Type": "application/json"
|
|
},
|
|
"body": {
|
|
"name": "Jane Doe",
|
|
"email": "jane.doe@example.com"
|
|
},
|
|
"expected_status_code": 200,
|
|
"assertions": [
|
|
{
|
|
"type": "json_path",
|
|
"path": "$.name",
|
|
"operator": "eq",
|
|
"value": "Jane Doe",
|
|
"_comment": "Verify user name is Jane Doe."
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Delete User",
|
|
"method": "DELETE",
|
|
"url": "https://example.com/api/users/123",
|
|
"headers": {},
|
|
"body": null,
|
|
"expected_status_code": 204,
|
|
"assertions": []
|
|
}
|
|
],
|
|
"load_profile": {
|
|
"tool": "k6",
|
|
"_comment": "Can be k6, gatling, or artillery",
|
|
"options": {
|
|
"vus": 10,
|
|
"duration": "10s",
|
|
"_comment": "k6 options, see k6 documentation for details"
|
|
}
|
|
}
|
|
} |