earloc / postomate

A library to automate and orchestrate requests out of a postman-collection with .net
MIT License
2 stars 0 forks source link

Provide convenience-methods for usage in SpecFlow-scenarios #17

Open earloc opened 3 years ago

earloc commented 3 years ago

When using SpecFlows ScenarioContext to find requests, there should be an easier way to find matching requests based on the current context.

E.g.: When executed in a scenarios steps, we currently need to deep-dive into the current scenario-context in order to gather the needed information to find a matching request, e.g.:

var request = featureFolder.FindRaw(scenarioContext.StepContext.StepInfo.BindingMatch.StepBinding.Regex, variables);

This should be shortened significantly, preserving the possibility to leverage either a simple stringor a RegExfor finding requests.

Maybe this would be OK to do via special extensions/overloads, which accept a ScenarioContext or so in https://github.com/earloc/postomate/blob/c5e14a81c1c7f9bf557f9bf8ad1aee3ed55a1b32/src/Postomate/Postman/RequestFolder.cs#L46 and https://github.com/earloc/postomate/blob/c5e14a81c1c7f9bf557f9bf8ad1aee3ed55a1b32/src/Postomate/Postman/RequestFolder.cs#L49.

However, this possibly would need to be done in a seperate Postomate.Extensions.*-assembly.