-
Notifications
You must be signed in to change notification settings - Fork 58
Test request data population (body & query string) #96
Comments
Now have data population for:
Will submit a PR from my fork. |
Hey @noahdietz -- I'm coming back around to using STT and am in need of the exact same feature. Any chance this PR is ready, or can I jump in to help complete? |
Actually, I just glanced at your branch and saw your implementation of adding optional parameters A couple of notes:
|
@mm-gmbd thanks for revisiting the project
|
I'm working on your second bullet right now 😄 .... unsuccessfully 😢 This requires somewhat of a fundamental shift in the way that STT approaches templating now. Currently, it generates templates by checking things in the following order:
EDIT (add): I think the workflow for 4 and 5 needs to be changed. Need to do call Here is some sample input I am giving for a particular path, so you can see where my head is at:
BTW -- I have made the decision that, for my API, an error code of 400 means that request validation has failed. All other failures will take on different HTTP error codes -- this means that for using STT, I know that my array of EDIT (add): Another note is that, in my project currently, all request validation will be done on data contained in the request body, but obviously there should likely be validation done on the data in either the path or query parameters. I'm starting from the body, but
Thoughts? |
I would like to avoid changing the traversal hierarchy if possible...my suggestion: We take the syntactic approach you've suggested in the STT config, allowing specification of values based on status code, stored in an array keyed to the path....however we do the evaluation of the request parameters (i.e. a look up in the I know I keep suggesting the handlebars helper, but they are the most configurable aspect of the module. The traversal should stay the same, but the information being passed on to the Handlebars compilers can be changed (with changes to the templates too), with the brunt of the data generation logic/work being handled by the helpers Does this make sense? What do you think @mm-gmbd |
Hmm, I understand what you're saying, but I'm not sure how to realize the goal of generation of multiple test cases per statuscode in the current structure, unless the templates were more heavily modified. And actually, maybe it's not as impossible as I'm thinking... For example, let's look at
Rather than passing bodyVals through the
|
Hi all, any progress on this? I am currently in the process of implementing the some kinda functionality using the swagMock module for data generation. Will push it soon and make a PR if anyones interested that is ;-) |
I have implemented a version of this but haven't submitted a PR, and I think the version I ended up with is closer to the way @noahdietz was hoping it would be. Rather than the way I wrote it in my last comment (modifying the template to include a big I can probably submit a PR in the near future (today/tomorrow). |
ha, cool! |
Opened a PR and included a few comments: #107 Only has body parameter input testing implemented, not query params. |
I am beginning work in my own fork on creating options for specifying the values of generated test request parameters in the body and query string, following a similar style to #91.
The options will take the form of JSON objects with values provided on a path-by-path, operation-by-operation basis. See the example below.
For a path specified as:
the corresponding parameter data would be passed to the function call options as:
The text was updated successfully, but these errors were encountered: