Endava / cats

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

Closed nayanmathur25 closed 3 months ago

nayanmathur25 commented 4 months ago

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:

  1. Mock the swagger file to local server.
  2. 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
  3. 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 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 }

en-milie commented 4 months ago

Thank you for reporting the issue. This is now fixed.

en-milie commented 3 months ago

It should be fixed in: https://github.com/Endava/cats/releases/tag/cats-11.7.0