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.11k stars 75 forks source link

[Functional Fuzzer] Requesting Ability to Set Parameter Values as NULL for POST Requests in CATs #80

Closed beam-me-up closed 9 months ago

beam-me-up commented 10 months ago

In my CATs test scenarios, I've noticed a behavior related to setting values as "null." While I can use the "cats_remove_field" flag to remove parameters for GET requests, I'm facing a situation with POST requests where I want to set a parameter's value as NULL without removing it entirely.

Examples:

For instance, consider the following YAML examples:

/pet/findByStatus:
    test_2:
      description: Get to status
      httpMethod: GET
      status: null 
      expectedResponseCode: 200

In this case, I can use "cats_remove_field" for GET requests to remove the "status" parameter completely.

However, for POST requests like this:

/pet:
    test_1:
      description: Create a Pet
      httpMethod: POST
      name: null
      expectedResponseCode: 200

I don't want to remove the "name" parameter, but I need to set its value as NULL.

Question:

Is there a way to set the value of a parameter as NULL explicitly for POST requests in CATs, without removing the parameter itself?

Any guidance or solution for this situation would be greatly appreciated.

en-milie commented 10 months ago

Hi @beam-me-up. I'll check a bit various scenarios and get back.

en-milie commented 10 months ago

This commit https://github.com/Endava/cats/commit/662412837b4d2724ab6ec7e1ad823a4169f74bad along with the fix for #75 will allow setting null values the way you have it in your example file. It will be available in next release.

en-milie commented 9 months ago

This is available now in: https://github.com/Endava/cats/releases/tag/cats-9.0.2

en-milie commented 9 months ago

@beam-me-up can this be closed now?

beam-me-up commented 9 months ago

Yes please. Thank you.