Refactored some parts of the testing infrastructure for easier reuse.
Fixed some of the new tests that did not run on the PC thread.