-
Notifications
You must be signed in to change notification settings - Fork 28
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
Enable changing only the snapshot filename #93
Comments
Hey @DavidInterad, thanks bringing this up. The current way of controlling snapshots is definitely a bit tedious. Let me have a think about some ideas and I'll get back to you in about 2 days and then we can go from there. |
So I had a think about it and what do you think about something like this. An optional parameter which takes in SnapshotSettings. You can override anything optionally (e.g. directory or the file name etc)
Still need to have a think about how the Storing snapshot per class feature (see this ) would be affected by this though. So this is very much a draft. What do you think? |
This would do the trick for me. For storing snapshots per class you could offer the same parameters in the |
Hey @DavidInterad , Just added Custom Snapshot Settings in the latest version 2.4.0. See the docs here. That should hopefully solve your issue? |
Looks promising, I will try it as soon as I find time (hopefully end of the week). |
Yes, that does the trick for me. Thank you very much :D |
Is your feature request related to a problem? Please describe.
Using tests with dynamic data (e.g. DataRow, DynamicData, DataSource) I want to control the filename of the snapshots, so they do not end up overwriting each other. But I do not want to hardcode any file path, just modify the filename.
Describe the solution you'd like
I would like to use
SnapshotId
to specify the snapshot filename, but settingsnapshotDirectory
to null so the default location (_snapshots
subdirectory) is used.Describe alternatives you've considered
I am currently using child snapshots instead, which is rather tedious because the snapshots themselves are rather large and there are many data rows.
There could be a way to specify the folder using path variables or getting the path from the test file, but both are rather tedious and undocumented in Snapper.
The text was updated successfully, but these errors were encountered: