Skip to content

Instantly share code, notes, and snippets.

@klamping
Created October 24, 2015 01:45
Show Gist options
  • Select an option

  • Save klamping/0a0cb74c2dae70ccad4b to your computer and use it in GitHub Desktop.

Select an option

Save klamping/0a0cb74c2dae70ccad4b to your computer and use it in GitHub Desktop.
Git usage for visual regression test images

Storing Baseline Images

Images are stored in the Git repo like any other file. This makes is simple to share baseline images across the teams. It also allows for changes in the baseline to be tracked over time.

Accepting/Rejecting changes

Whether or not updates to the baseline images are accepted depends on the goal of the changes. Here are a few scenarios:

No visual changes

If no visual changes occur (and none were expected), then nothing needs to be checked in.

Unwanted visual changes

If visual changes occured (new images in the diff directory), but they weren't intended, that means there was a regression in the UI output. Review the diffs and fix the visual changes that occurred. No files should be checked in.

Wanted visual changes

If visual changes occur and are warranted, the following steps will need to be taken to update the baseline images:

  1. Delete the contents of the baseline & diff image directories.
  2. Run the test suite again.
  3. Add/commit all updated images.
  4. Submit a Pull Request to the GitHub repo with both the updated functionality and the new images.
  5. Have another team member review the new images. Github has useful image diff tools to help compare the changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment