It would help to know what model.
I have an older Craftsman with a Kohler Magnum 18, it had the symptoms stated above and it was the magneto.
I went through all the other diagnostics including rebuilding the carb, fuel lines, fuel filter, cap vent, plugs.