Your test should verify if the code solves the problem, not if it runs

A few salient points from the post:

Your code is fragile if

  • structure of the code allows you to make a breaking change without a test failure
  • you have a high degree of coupling between code and their test files

Write code such that if you separate the structure of the code according to the structure of the problem, you won't have to change the structure of the code unless the structure of the problem changes completely.

The tests should stay passing in a refactoring operation. Otherwise, that's not refactoring. If you make changes in the code that doesn’t change behavior, you should not make the tests fail.

Full post here, 10 mins read