Work from the bottom up

When copying a test, make your changes from the bottom up, renaming the copied function as the last step.

Last week I talked about a snafu I made while copy-and-pasting some tests. When I mentioned this same story on LinkedIn, I was pointed to a nifty trick which comes from Woody Zuill:

Work from the bottom up

That is to say, when you copy a test for use against a new function, start at the bottom of the copied function, and work your way up making changes. Then change the name of the copied function last.

If I had followed this simple advice, I would not have encountered my problem.

Thanks Woody, for the simple hacking hack!

Share this