Test Cases Created From OpenAPI spec not adhering to specifications #200
-
Hello Kerry, I am trying to create test cases from my OpenAPI spec but am running into troubles because I am getting test cases that do not adhere to the openapi specifications. This is happening particularly for a variable that is coming as null when I have set nullable to false. This is happening in a test called getAPI_XisDefined_Is_Yes(). I have clearly stated that X should not be nulled out in the openapi spec under the "schema" section. However, in the test I stated above, X is nulled out. I am curious about what is happening in this test and if its a mistake in the specification document or something that TCases is not recognizing. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
Can you attach the OpenAPI file so I can reproduce this? Also, have you looked at messages in the log file? This is usually a file named tcases-api-test.log. |
Beta Was this translation helpful? Give feedback.
-
This problem happens when TFOA generates inconsistent test cases for null vs. empty values -- see issue #201. In the case shown above, you can work around the problem by adding |
Beta Was this translation helpful? Give feedback.
This problem happens when TFOA generates inconsistent test cases for null vs. empty values -- see issue #201.
In the case shown above, you can work around the problem by adding
"minItems": 1
to the schema for StudentIDs. This tells TFOA that an empty array (which in this case looks that same as a null array) is not a valid value. This is not a perfect solution, because it will also result in redundant failure test cases -- one for an invalid null value and another for an invalid empty value.