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

The filtering predicate to filter fuzzerToRun is now working properly #109

Closed ganeshnikam18 closed 7 months ago

ganeshnikam18 commented 7 months ago

CATS Version: 10.3.0

What is the issue? POST request for one of the path is not getting fuzzed.

Spec file: petstore-country-code.json

Steps to reproduce the issue:

  1. Run the prism mock server with above spec file
  2. From other machine run the CATS tool with one fuzzer: MaxLengthExactValuesInStringFieldsFuzzer
  3. For /pets path there is POST method defined and in the "Pet" object there is "name" field with maxLength defined
  4. So ideally, CATS should fuzz this object and send one request with POST method
  5. But CATS will not send any request

What is the root cause? This predicate to filter out fuzzerToRun is not working properly. If path have GET, DELETE and POST method, then this predicate filters out fuzzers which are only applicable for POST, PUT, PATCH methods, for the current path.

What is the fix? I have added the fix by putting correct predicate logic. It is base on List.containsAll() method

Please review the fix and update if required

en-milie commented 7 months ago

Thank you for this. I'll make sure I add an unit test to remain consistent in the future.