Re:Show HN: Touca – open-source superior alternative to snap...
by ajjenkins on Monday February 27, 2023 @11:04PM
(#34965478)
I like this. TDD purists would probably complain that you don’t assert a specific value, but in practice I know a lot of people hardcode the assert values for their tests based on the test output. So this just automated that, I guess. If I was looking for a new test framework, I would consider this.
[ Parent
| on HN ]
Re:Show HN: Touca – open-source superior alternative to snap...
by pejman_gh on Monday February 27, 2023 @11:24PM
(#34965604)
Glad to hear. Yes, your understanding is very accurate. TDD requires a different mindset. Our primary focus has been do a great job of finding side effects of code changes to existing systems such as day-to-day refactors and occasional rewrites. From my personal experience, these are the scenarios in which having hard-coded expected values in assertions is inconvenient and requires mechanical adjustments. Thanks for taking the time to review this and sharing your thoughts.
Re:Show HN: Touca – open-source superior alternative to snap...
by drothlis on Tuesday February 28, 2023 @03:41AM
(#34967088)
Some ideas I got from Jeremias Rõßler's talk: https://t.co/xWtA58Q9q5
- Snapshot testing is like version-control but for the outputs rather than the inputs (source code).
- Asserts in traditional unit tests are like "block lists" specifying which changes aren't allowed. Instead, snapshot testing allows you to specify an "allow list" of acceptable differences (e.g. timestamps).