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

Sequential request matching with rules #73

Open
colintheshots opened this issue May 4, 2018 · 2 comments
Open

Sequential request matching with rules #73

colintheshots opened this issue May 4, 2018 · 2 comments

Comments

@colintheshots
Copy link

colintheshots commented May 4, 2018

It seems like it should be possible to write a sequential replay test where I can match rules, but record multiple interactions per rule set. This would help by not enforcing strict ordering of requests like a pure sequential test, but would allow repeated queries to an endpoint with differing responses each time.

It seems like the best behavior for this type of test would be to record rules to tape as long as READ_WRITE is active and then parse the rules when READ_ONLY is active. You would consume the rules sequentially until only one is left and then reuse it for all future requests which match that rule set.

I'm not sure how hard this would be. I may take a look at implementing it.

@krpiotrek
Copy link

Hi @colintheshots, have you been working on that?

@jraska
Copy link

jraska commented Aug 12, 2018

Hi, I had the same issue and I implemented some workaround with adding extra query parameter for OkReplay to record the requests separately, but not enforcing strict ordering of other requests.

Check here: https://github.com/jraska/github-client/blob/master/client/src/androidTest/java/com/jraska/github/client/http/CustomOkReplayInterceptor.kt

One interceptor adds the parameter before OkReplayInterceptor and other one removes it straight after to isolate it only for OkReplay.
I had to extend OkReplayIntercptor to capture the methods start and stop, to clear the internal mappings whilst switching tapes.

Works for me, let me know what you think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants