Skip to main content

Touca vs. Snapshot Testing

Many existing products offer visual regression testing for web applications. But a large subset of software developed every year is in products that have limited or no user interface. A common existing solution for testing these products is snapshot testing.

Snapshot testing is a type of testing that involves capturing the current state of a software workflow, and comparing it to a previously saved "snapshot" file to ensure that the component has not changed in an unexpected way. This can be useful for detecting changes that might indicate a bug or other problem, such as changes in the layout or styling of a user interface component. The snapshot files are typically stored alongside the test code, and are updated whenever the test is run and the component's behavior changes in an expected way.

Most snapshot testing libraries leave the comparison and management of these files to software engineers. Managing result files for hundreds of test cases is not feasible at scale. Touca stores test results in a remote server to remove the need for managing snapshot files. It automatically compares test results against your baseline version, and reports differences in an easy-to-understand format so that engineers only need to decide what to do with those differences.

Because snapshot files store the overall output of a workflow, they may contain dynamic data such as timestamps, that can trigger false positives during comparison. They can miss important information that may not necessarily be exposed through the software interface. Touca gives you fine-grained control over what variables and return values to capture as test results. Instead of writing results into text files, Touca SDKs preserve the types of your captured data and compare your test results using their original data type.