Moved: this library now lives at
diffplug/selfie-lib, with docs at lib.selfie.dev. Maven and PyPI coordinates and the API are unchanged, so you don't need to change anything. Read the announcement.
- Just add a test dependency (py, jvm), zero setup, zero config.
- Snapshots can be inline literals or on disk.
- Use
expect_selfiefor testing orcache_selfiefor memoizing expensive API calls. - Disk snapshots are automatically garbage collected when the test class or test method is removed.
- Snapshots are just strings. Use html, json, markdown, whatever. No magic serializers.
- Record multiple facets of the entity under test, e.g. for a web request...
- store the HTML as one facet
- store HTML-rendered-to-markdown as another facet
- store cookies in another facet
- assert some facets on disk, others inline
- see gif above for live demo, detailed example here
Python and JVM ports are both production-ready.
- Quickstart (py, jvm)
- Facets (py, jvm)
- Caching / memoizing (py, jvm)
- Why selfie (py, jvm)
- API reference (py, jvm)
PRs welcome! Horror stories and glory stories too, share your experience! See CONTRIBUTING.md.
Heavily inspired by origin-energy's java-snapshot-testing, which in turn is heavily inspired by Facebook's jest-snapshot.
