statusCode to reflect what is available in the openAPI #238
Replies: 4 comments 16 replies
-
Hi @savage-alex, The Portman contract tests are organised around the following concepts:
For variation tests, you can instruct Portman which OpenAPI response you want to test against by setting the openApiResponse
If the We have a variation example that showcases the usage |
Beta Was this translation helpful? Give feedback.
-
FYI: In theory, you don't need the combination of By adding the
{
"version": 1.0,
"tests": {
"contractTests": [
{
"openApiOperation": "*::/*",
"statusSuccess": {
"enabled": true
}
},
{
"openApiOperation": "*::/*",
"statusCode": {
"enabled": true
}
}, |
Beta Was this translation helpful? Give feedback.
-
@savage-alex FYI: We inject contract tests (happy path) for all OpenAPI responses ranging from 200 till 302 So if you have a 201 or 204 or even a 302, this will be considered the happy path for the normal contract tests, if there are multiple "happy path" responses are defined, the 1ste happy response will be used as expected response for which Portman will generate the contract tests. For variation tests, you can define the expected OpenAPI request using |
Beta Was this translation helpful? Give feedback.
-
Tested this with the latest release and it works great. How can we close this dicussion please? |
Beta Was this translation helpful? Give feedback.
-
I am trying to create a generic catchall contract test starter.
One of the things I noticed was that when using statusCode
The test created in postman always requires 200 to be returned even if that is not what is in the OpenAPI.
I understand statusCode takes in a code parameter but would it be beneficial if that is not present to allow any of the codes from that operations openAPI to be present?
Love to hear your thoughts?
Beta Was this translation helpful? Give feedback.
All reactions