A flexible Swift library for replaying HTTP requests in unit tests, inspired by VCR.
Vinyl is a Swift library for replaying HTTP requests in unit tests, similar to VCR in Ruby. It allows developers to record and playback network interactions, ensuring tests are fast, reliable, and independent of external services. It solves the problem of flaky network-dependent tests by providing pre-recorded responses.
iOS, macOS, and tvOS developers who write unit tests for network-heavy applications and use dependency injection in their architecture.
Developers choose Vinyl for its flexibility in request matching, support for multiple recording modes, and compatibility with existing DVR cassettes, making it a versatile alternative to stricter mocking libraries.
Network testing à la VCR in Swift
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports both attribute-based mapping and queue-based track ordering, with customizable matchers for URL, body, headers, etc., as detailed in the MatchingStrategy examples.
Includes recording modes like .missingVinyl and .missingTracks to automatically generate test fixtures from real network requests, saving time on manual setup.
Offers a compatibility mode to reuse existing DVR cassettes without rewriting tests, easing migration from older libraries.
Allows programmatic creation of tracks using TrackFactory, not just JSON files, enabling dynamic response mocking in tests.
Marked as a pre-release version with pending features like debug mode on the roadmap, which may lead to instability or breaking changes.
Optimized for apps with dependency injection; using it with fixed URLSession architectures requires workarounds or is not recommended, per the README.
Debug mode is listed as a roadmap item and not yet implemented, hindering troubleshooting during test development or failure analysis.
Vinyl is an open-source alternative to the following products: