specmatic icon indicating copy to clipboard operation
specmatic copied to clipboard

Finer-graded control of responses

Open julianharty opened this issue 4 years ago • 2 comments

Is your feature request related to a problem? Please describe. I would like to be able to implement fine-graded control of responses e.g. to response first with response A then next time with response B, or to assign weightings e.g. respond 70% of the time with the OK response (think HTTP 200 response), 10% with a server-error response (think HTTP 5xx responses), and 20% with a your request failed response (think HTTP 4xx responses).

These would enable me to automate and test using richer conversations.

Describe the solution you'd like A mechanism where I could:

  • pre-specify the 'rules' that qontract (or a delegated utility) would return;
  • control the responses on-the-fly where I can do so without needing to shutdown or restart the qontract server.

Describe alternatives you've considered hmmmm. Looking for another tool? To be honest, I've not really considered many alternatives, I can envisage this being a great enhancement if it's practical to implement.

Additional context I mentioned a wishful idea of using a plugin architecture in #148 perhaps this is another example of where plugins might work well?

julianharty avatar Dec 20 '20 17:12 julianharty

BTW: I'd like similar abilities to do things such as delay responses by varying amounts. It would also be useful if the server logs would include the details used (and optionally e.g. if configured to run in verbose mode, to include the rule that was applied to the response).

julianharty avatar Dec 20 '20 17:12 julianharty

If I've understood the bit about delayed responses, it's supported.

However, there's nothing in the logs that tells you that a delay was introduced, and by which stub expectation.

joelrosario avatar Dec 20 '20 18:12 joelrosario