Removed dependency on global state

By moving the dependency to the TestContext instead of global state, we
avoid nasty problems if parallel execution should be implemented.