.NET
The Only Type of Testing You Need (Nick Chapsas)
- There is a NuGet package Verify that does snapshot testing.
- “Verify is called on the test result during the assertion phase. It serializes that result and stores it in a file that matches the test name. On the next test execution, the result is again serialized and compared to the existing file. The test will fail if the two snapshots do not match: either the change is unexpected, or the reference snapshot needs to be updated to the new result.”
- The expected results will be additional files for you to check in to your repo, and you’ll need to ignore the “received” output as a file to commit. You can also use it to verify exceptions being thrown.
- This fits the narrative for unit tests and integration tests. If you search NuGet for “Verify.” you’ll see it has things for HTTP, Entity Framework, etc.
- There are also ways to scrub GUIDs that may differ from run to run.
- Caveat: This relies on the first time you run the test, that the test is passing and producing the correct result.
Always Return Early in Your Code | Code Cop #024 (via Nick Chapsas)
Returning early to avoid unnecessary nesting is fine. Nick had an issue with how the provider of said advice made the code as terse as possible, thus making it even less readable. Bonus tip: Don’t return null collections.
Work-life balance
Let’s End Toxic Productivity (via HBR)
I recognized many of the traits listed in the article, and I know I have work to do as a leader to break this cycles as well. The article talks about how we became obsessed with productivity, the stigmatization of rest, and some tips about reducing meetings (which seem to be a large contributor to overwork).