Asynchronous safe code for running tests.