There is a lot of knowledge out there on automated testing. You can learn how to write unit tests, do TDD, construct test pyramid, use one particular testing framework or another.
What I have been missing is materials on sustainable testing: so writing automated tests that not only will do their job today, but will also defend themselves against change over time and will not cost a fortune to maintain. Inspired by Scott Meyers formula for a few of his books, I created a repository of riddles showcasing common issues with test sustainability, and offering remedies.
Many of the riddles were inspired by observations in projects I had a pleasure to work on; and even tested in form of workshops on my colleagues. If you have any suggestions or feedback on any content on this site,.
Each riddle shows a code snippet: a chunk of production code and the corresponding test code. Don't nitpick on the production code, though, that's not why we're here. Challenge the test code. It will look pretty decent at first glance. But it will always have a weakness, which will reveal itself over time, e.g. in response to a change in the system, which may lead to loss of test coverage or expensive maintenance.
The code is in C++ and uses GTest & GMock frameworks. All of the riddles assume some understanding of them. However, only some of the principles are specific to the Google frameworks - most of them apply just as well to other frameworks or languages even.