Closed a-waider closed 1 year ago
Hi @a-waider. Can you plead post an OpenApi spec file as an example?
This is a stripped down openAPI document:
openapi: 3.0.1
info:
title: Some title
version: 1.0.0
servers:
- url: http://localhost:8080
description: Local development
variables: {}
paths:
/some/path:
post:
summary: some summary
operationId: someID
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/someRequestSchema"
examples:
default:
description: some description
value:
key:
- key1: 1
key2: 2
key3:
- key: 3
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/someResponseSchema"
CATS ExamplesFields fuzzer generates 2 Tests for it:
{}
as payload. Due to some required fields in the body the server will respond with HTTP 400. E.g. the body requires someKey
: {"someKey": 1}
From the description I would expect that only tests for the specified examples would be generated. Therefore CATS should only create 1 test for the default example.
Can you please check with https://github.com/Endava/cats/releases/tag/cats-8.5.0
Yes, it seems to be working now as I would expect it. Thanks for your very quick response :)
The ExamplesFields fuzzer should produce tests for every endpoint with all defined examples. My endpoints require a not empty JSON body otherwise they will respond with HTTP 400. CATS generates for every request an additional example with an empty JSON body:
The examples in the openAPI document do not include an empty JSON body. Is this behaviour expected?