Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP client steps: remove combinatorial complexity #1

Open
farbodsaraf opened this issue Sep 8, 2016 · 0 comments
Open

HTTP client steps: remove combinatorial complexity #1

farbodsaraf opened this issue Sep 8, 2016 · 0 comments

Comments

@farbodsaraf
Copy link

farbodsaraf commented Sep 8, 2016

There can be many combinations of headers, body, etc. when composing a request:

  • no headers, no body
  • no headers, with body inline (in the .feature file)
  • ho headers, with body from file
  • with headers, no body
  • with headers
  • with headers, with inline form parameters body (table in the .feature file)
  • with headers, multipart body
  • etc.

The current approach is to have a step for each combination. This leads to an explosion in the number of required steps.
Refactor to allow the request to be composed using multiple steps:

Given   the request headers
      | Content-Type | application/x-www-form-urlencoded |
And   the form body parameters
      | grant_type | password            |
      | client_id  | com.farbodsaraf     |
 When  I call 'POST' on '/authserver/oauth/token'

This way, you can compose whatever request is needed, and the code remains maintainable.

The intermediary information (headers, body, etc.) can be saved in story variables.
Important note: the steps that perform the actual request should clear all such story variables, so that another request in the same scenario will not be affected.

@cvmocanu cvmocanu changed the title Request Builder Complexity Reduction HTTP client steps: remove combinatorial complexity Sep 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants