Content
View differences
Updated by Kabiru Mwenja almost 3 years ago
**Problem:** Our current static web mocks can become stale without any alarms if there are breaking changes in the Nextcloud API. Instead, we want to record real HTTP interations with Nextcloud that re refreshed periodically and use those in our tests.
**Proposed Solution:** In ruby land, the [VCR](https://github.com/vcr/vcr) gem is great at this and hooks into WebMock
> Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.
**Pros:**
1. In case of any Nextcloud API regressions, our tests should report failures _(dependent on the recorded requests last update)_
2. Reduce test setup fatigue, as we should now be able to replace WebMocks with a single line \`VCR.use\_cassette("module/path/to/cassete\_name")\`
3. VCR Cassets can be grouped by HTTP status/ expected behaviour- making them easier to reuse and maintain
**Cons:**
1. Requires a real integration connection in test environment to record the first interaction
2. Without automatic re recording configuration, we'll need to refresh these cassettes manually,
**Out of Scope**
* Automatic re recording of cassettes. See [Docs](https://benoittgt.github.io/vcr/#/cassettes/automatic_re_recording)
_Links:_
* [https://benoittgt.github.io/vcr/#/](https://benoittgt.github.io/vcr/#/)
* [https://github.com/vcr/vcr](https://github.com/vcr/vcr)
**Proposed Solution:** In ruby land, the [VCR](https://github.com/vcr/vcr) gem is great at this and hooks into WebMock
> Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.
**Pros:**
1. In case of any Nextcloud API regressions, our tests should report failures _(dependent on the recorded requests last update)_
2. Reduce test setup fatigue, as we should now be able to replace WebMocks with a single line \`VCR.use\_cassette("module/path/to/cassete\_name")\`
3. VCR Cassets can be grouped by HTTP status/ expected behaviour- making them easier to reuse and maintain
**Cons:**
1. Requires a real integration connection in test environment to record the first interaction
2. Without automatic re recording configuration, we'll need to refresh these cassettes manually,
**Out of Scope**
* Automatic re recording of cassettes. See [Docs](https://benoittgt.github.io/vcr/#/cassettes/automatic_re_recording)
_Links:_
* [https://benoittgt.github.io/vcr/#/](https://benoittgt.github.io/vcr/#/)
* [https://github.com/vcr/vcr](https://github.com/vcr/vcr)