Starter docs here. This needs to be fleshed out more.
The future is here!
Make flaky tests more reliable by using Polly and polly-proxy to fake API calls.
How does it work?
Your app should make a call to polly-proxy to create a proxy for a service, such as foo.example.com. All requests to this service on behalf of the user agent should go through this special proxy.
When a test begins, make a call to /replay on polly-proxy which starts replaying a recording over from the beginning. This recording should lives in your app's repo alongside the tests, so they always stay in sync.
If a request is found in the recording, it will be replayed as if a real request had been made. This is transparent to your app - consuming code will have no indication that the request has been faked.
If a request is not found in a recording, a 500 error will be returned. Consider making it easy to update the tests in development, so that the recording will be updated instead of an error being returned.
POST-ed data must be deterministic! If your app uses randomly generated data, this data will need to be generated from behind the proxy from a simple web service.
Starter docs here. This needs to be fleshed out more.
The future is here!
Make flaky tests more reliable by using Polly and polly-proxy to fake API calls.
How does it work?
polly-proxy
to create a proxy for a service, such asfoo.example.com
. All requests to this service on behalf of the user agent should go through this special proxy./replay
onpolly-proxy
which starts replaying a recording over from the beginning. This recording should lives in your app's repo alongside the tests, so they always stay in sync.