void Utest::run(TestResult& result) { //save test context, so that test class can be tested Utest* savedTest = getCurrent(); TestResult* savedResult = getTestResult(); result.countRun(); setTestResult(&result); setCurrentTest(this); if (executePlatformSpecificSetup()) { executePlatformSpecificTestBody(); } executePlatformSpecificTeardown(); setCurrentTest(savedTest); setTestResult(savedResult); }
// Spawn a thread to a test void ActiveTest::run(TestResult* result) { CWinThread* thread; setTestResult(result); _runCompleted.ResetEvent(); thread = AfxBeginThread(threadFunction, this, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED); DuplicateHandle(GetCurrentProcess(), thread->m_hThread, GetCurrentProcess(), &_threadHandle, 0, FALSE, DUPLICATE_SAME_ACCESS); thread->ResumeThread(); }