3 ms·
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 t
by ajjenkins 4y ago
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.
- pejman_gh 4y agoGlad 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.
- drothlis 4y agoSome ideas I got from Jeremias Rõßler's talk: https://t.co/xWtA58Q9q5 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).