How can I include the base URI and custom headers in the API test cases using tcases #191
-
Hi, While generating API test cases using the below command, I am seeing that the base URI is not getting included to the tests. My endpoints also need an authentication header (bearer token) to be added to each request.
How can I make tcases generate the API test cases with the baseURI() and headers() populated in it with my defined values? Thanks again. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
For the base URI, Tcases uses the first element of the It's reasonable to expect that the |
Beta Was this translation helpful? Give feedback.
-
For the authentication token, this is currently not supported. See issue #115. |
Beta Was this translation helpful? Give feedback.
For the base URI, Tcases uses the first element of the
servers
property defined by the OpenAPI document. Your example shows what happens whenservers
is missing or empty. Although, when defined, you'll see this server URI included in therequest
URL, not in thebaseUri
setting.It's reasonable to expect that the
servers
array could list different URIs for different test environments. In which case, it would be helpful to have a way to select the one to use for the generated test, using a parameter specified at runtime. Unfortunately, there's no well-defined identifier associated with a Server object. One solution might be a parameter that specifies a regex to match theserver.description
.…