Redesign test runner to move platform specific parts into their own functions