A good way to make code more testable: refactor your code that does a thing into two parts: first part creates a plan, second part executes the plan. The first part is where your logic is, and is easier to test than the original code.
A good way to make code more testable: refactor your code that does a thing into two parts: first part creates a plan, second part executes the plan. The first part is where your logic is, and is easier to test than the original code.
If you have a fediverse account, you can quote this note from your own instance. Search https://hachyderm.io/users/nedbat/statuses/114716785561047379 on your instance and quote it. (Note that quoting is not supported in Mastodon.)