Testing certainly ought to be the first step, but it doesn't always isolate the problem. In the past couple of years I’ve had two situations where a bad power cord was the source of the problem despite testing out good at the switch. A Makita hypoid saw stopped working between one pull of the trigger and the next. Opening it up I determined that I had power to the switch. I couldn’t find the problem so I put it away until I had more time to work with it. Later it checked out the same, but it turned out to be a bad power cord, anyway. The braided copper wire in one of the conductors must have separated but by chance got pushed back together when I checked it at the switch, twice.
Recently, my DeWalt drill would only run when plugged into one outlet in my garage. It wouldn’t run when plugged into any other outlet although other equipment would. Finally, I discovered that it worked in that outlet because there was a shelf in front of it and the cord went over it and down to the outlet. This put it into position for the separated wire near or in the plug to be pushed back together. When the cord would hang from any other outlet, the wire would separate and the drill wouldn’t run.