Skip to content
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

Save all artifacts to disk in the event of failure #902

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

leandrodemarco
Copy link

Objective:

In the event of a failing snapshot test, keep in disk artifacts not only for the snapshot that failed, but also for the reference against it was compared to and the diff between them. (Probably sort of what´s being requested in issue #176)

The easiest way I figured out to do this is by adding a third parameter returned by diff closure from Diffing struct, but of course I´m open to suggestions if there are neater/simpler ways (I explored XCTestAttachment since the function is already returning these, but found no way of getting out images from there).

Context

I´m trying to move away my projects from iOSSnapshotTestCase (previously FBSnapshotTestCase) to this library, since the other ones are no longer maintained and this one seems much more flexible and customizable.

One of the things I´d miss from those libraries though is the ability to get, in the event of failure, all three artifacts, for ease of analysis in CI/CD

Experiment ran for verifying

I created some snapshot tests for a simple view to which I added a red background color. Reference images were generated/recorded with this color. Then changed background color to blue, disabled record mode and ran tests again for them to fail. Resulting folder content is depicted in beneath screenshot

WhatsApp Image 2024-09-06 at 18 34 28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant