Calculating deep diff on any data #149
AttilaMihaly
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem Statement
During testing we compare actual values generated by some functionality with the values we expected. This is usually implemented as a simple equality check which works great for simple values like numbers, strings or enums. When we are testing a larger piece of functionality though we often have to compare larger and more structured values. In this case, the equality check is good for catching the bug but to fix it we need to pinpoint where the issue is which requires us to dig deeper and understand exactly which part of the structure is causing the mismatch.
This usually involves breaking down the structured value into smaller parts and comparing them individually. Sometimes this is done ad-hoc but even when it's done programmatically it's a tedious process that Morphir could automate. Morphir is aware of the structure of the data through type information and can do the decomposing and even help with doing more clever comparison for specific type of values (like date diff instead of string diff for date values which is much more useful to find issues with date logic).
Such a diff functionality would have potential uses far beyond unit-testing. It can help with BDD, regression tests and even variance analysis on production data.
User Stories
Beta Was this translation helpful? Give feedback.
All reactions