In short game event logging and replay is how you automate this. I don't know of any 3rd party software that does this (qualifier: SDK to integrate into app), but doing it yourself is both really easy and perhaps really hard.
You use game events to mean stuff like "pressed the X key" or "moved the mouse by (10,2)"
You play the game once recording each keystroke/mouse movement and the precise time it occured relative to the start of the recording. Once you are finished recording, you run the program again, but instead of generating the events from the mouse/keyboard, you simply play back the events you recorded, in order, at the right time. So, say if you found a reproducible bug that takes a few minutes of running around waving a sword or jumping into a wall, then you can record all of your actions and replay them again and see if you get the same results (if you have a deterministic engine, you should). Then you can make fixes, play it back again, etc. until the bug is fixed.
Though it isn't the same purpose, you've probably seen this method in old arcade games ('demo mode' before you insert a coin). It would have been too expensive to simply record a fullscreen demo to playback when the machines have < 1024KB of RAM, so the they record the actions and play them back as a sort of "real-time video" or "compression".
Getting the game/engine to be deterministic is a lot harder though.