CATS is a REST API Fuzzer and negative testing tool for OpenAPI endpoints. CATS automatically generates, runs and reports tests with minimum configuration and no coding effort. Tests are self-healing and do not require maintenance.
Apache License 2.0
1.17k
stars
74
forks
source link
Default value [application/json] or any other value in produces and consumes are not fetched for swagger 2.0 #127
Describe the bug
Default value [application/json] or any other value in produces and consumes are not fetched for swagger 2.0 because of this cats tool expected [] is going blank.
To Reproduce
Steps to reproduce the behaviour:
Mock the swagger file to local server.
Run the cats command
cats --contract=http://localhost:port/swagger.json --server=http://localhost:port/ --fuzzers=DecimalFieldsLeftBoundary,DecimalFieldsRightBoundary,DecimalNumbersInIntegerFields,EmptyStringsInFields,IntegerFieldsLeftBoundary,IntegerFieldsRightBoundary,InvalidValuesInEnumsFields,IterateThroughEnumValuesFields,MaxLengthExactValuesInStringFields,MaximumExactNumbersInNumericFields,MinLengthExactValuesInStringFields,MinimumExactNumbersInNumericFields,NewFields,NullValuesInFields,RandomStringsInBooleanFields,RemoveFields,StringFieldsLeftBoundary,StringFieldsRightBoundary,StringFormatAlmostValidValues,StringFormatTotallyWrongValues,StringsInNumericFields
You will observe the result for POST request for "path": "/parents" will be
"resultDetails": "Response content type not matching the contract: expected [], actual [application/json]",
Expected behaviour
If you refer the swagger file attached the produces and consumes are defined at the global level. All endpoints will default to using application/json for both requests and responses unless otherwise specified.
Environment:
Additional contextSwagger2.0.json
{
"scenario": "Remove the following fields from request: [name]",
"result": "warn",
"resultReason": "Response content type not matching the contract",
"id": "Test 14",
"fuzzer": "RemoveFields",
"path": "/parents",
"resultDetails": "Response content type not matching the contract: expected [], actual [application/json]",
"timeToExecuteInSec": 0.539,
"httpMethod": "post",
"switchedResult": false
},
{
"scenario": "Remove the following fields from request: [id]",
"result": "warn",
"resultReason": "Response content type not matching the contract",
"id": "Test 15",
"fuzzer": "RemoveFields",
"path": "/parents",
"resultDetails": "Response content type not matching the contract: expected [], actual [application/json]",
"timeToExecuteInSec": 0.607,
"httpMethod": "post",
"switchedResult": false
}
Describe the bug Default value [application/json] or any other value in produces and consumes are not fetched for swagger 2.0 because of this cats tool expected [] is going blank.
To Reproduce Steps to reproduce the behaviour:
Expected behaviour If you refer the swagger file attached the produces and consumes are defined at the global level. All endpoints will default to using application/json for both requests and responses unless otherwise specified.
Environment:
Additional context Swagger2.0.json { "scenario": "Remove the following fields from request: [name]", "result": "warn", "resultReason": "Response content type not matching the contract", "id": "Test 14", "fuzzer": "RemoveFields", "path": "/parents", "resultDetails": "Response content type not matching the contract: expected [], actual [application/json]", "timeToExecuteInSec": 0.539, "httpMethod": "post", "switchedResult": false }, { "scenario": "Remove the following fields from request: [id]", "result": "warn", "resultReason": "Response content type not matching the contract", "id": "Test 15", "fuzzer": "RemoveFields", "path": "/parents", "resultDetails": "Response content type not matching the contract: expected [], actual [application/json]", "timeToExecuteInSec": 0.607, "httpMethod": "post", "switchedResult": false }