TVerdict CContactViewTest::doTestStepPostambleL()
	{
	iSemaphore.Close();
	EndRecoverL();
	EndCompressL();
	return CCntBaseStep::doTestStepPostambleL();
	}
TVerdict CPerformanceFunctionalityBase::doTestStepPostambleL()
	{
	_LIT(KPostamblePrint,"I am in Base doTestStepPostambleL()");
    INFO_PRINTF1(KPostamblePrint);
    EndCompressL();
    EndRecoverL();
	Cleanup();
	delete iViewAll;
	delete iIterate;

	WaitForServerToExitL();//waits for server to close to allow for any memory leaks to be detected

    if( !iConcurrent && !iUnclean )
    	{
		TRAPD(err, CContactDatabase::DeleteDefaultFileL() );
		if( err != KErrInUse && err!= KErrNotFound )
			{
			User::LeaveIfError( err );
			}
    	}

	return TestStepResult();
	}
/**
Test wrapper for performing all comapct and recover tests
start recover/compress
perfrom database operations, expecting recover/compress errors
end recover compress
perform database operations again, expecting no errors
*/
void CCompactAndRecoverStep::TestWrapperL(
									void (CCompactAndRecoverStep::*aOperations)(const TInt ), 
									const TInt aErr, 
									const TInt aErr2, 
									const TInt aErr3, 
									const TInt aErr4 )
	{
	if(iCompleteSteps)
		{
		INFO_PRINTF1(KCompleteSteps);
		}
	else
		{
		INFO_PRINTF1(KCancelSteps);
		}
	
	//start compress/recover	
	if( iRecoverFlag )
		{
		StartRecoverL();
		}
	else
		{
		StartCompressL();
		}
	
	//perfrom database operations	
	#ifdef _DEBUG
	
	(this->*aOperations)( iRecoverFlag ? aErr : aErr2 );
	(void)aErr3;
	(void)aErr4;
	
	#else
	
	(this->*aOperations)( iRecoverFlag? aErr3 : aErr4 );
	(void)aErr;
	(void)aErr2;
	
	#endif
	
	//end recover / compress
	if( iRecoverFlag )
		{
		EndRecoverL();
		}
	else
		{
		EndCompressL();
		}
		
	CContactDatabase *temp = iContactsDatabase2;
	iContactsDatabase2 = iContactsDatabase;
	iContactsDatabase = temp;
	
	//perfrom database operations expecting no errors
	(this->*aOperations)( KErrNone );
	
	temp = iContactsDatabase2;
	iContactsDatabase2 = iContactsDatabase;
	iContactsDatabase = temp;
	}
TVerdict CContactViewTest::doTestStepL()
	{

	void (CContactViewTest::*mainFunc)() = NULL;

	const TDesC &run = ConfigSection();

	if( run.Find( KRun1 ) > KErrNotFound )
		{
		mainFunc = &CContactViewTest::AllEmptyTestL;
		}
	else if( run.Find( KRun2 ) > KErrNotFound )
		{
		mainFunc = &CContactViewTest::ViewEmptyTestL;
		}
	else if( run.Find( KRun3 ) > KErrNotFound )
		{
		mainFunc = &CContactViewTest::ContactEmptyTestL;
		}
	else if( run.Find( KRun4 ) > KErrNotFound )
		{
		mainFunc = &CContactViewTest::AllFullTestL;
		}
	else if( run.Find( KRun5 ) > KErrNotFound )
		{
		mainFunc = &CContactViewTest::EmptyFieldsetTestL;
		}
	else if( run.Find( KRun6 ) > KErrNotFound )
		{
		mainFunc = &CContactViewTest::EmptyFieldsetSortTestL;
		}
	else if( run.Find( KRun7 ) > KErrNotFound )
		{
		mainFunc = &CContactViewTest::MissingFieldTestL;
		}
	else if( run.Find( KRun8 ) > KErrNotFound )
		{
		mainFunc = &CContactViewTest::PerformanceTestL;
		}
	else if( run.Find( KRun9 ) > KErrNotFound )
		{
		mainFunc = &CContactViewTest::RecoverCompressTestL; // this test does not apply to the SQLite version of contacts
		}
	else if( run.Find( KRun10 ) > KErrNotFound )
		{
		mainFunc = &CContactViewTest::ConcurrentRecoverCompressTestL; // this test does not apply to the SQLite version of contacts
		}
	else
		{
		MissngTestPanic();
		}

	__UHEAP_MARK;

	iRemote = EFalse;
	ALLPRINT(KStars);
	if( iPLView )
		{
		_LIT(KPersistance,"Initialising LocalView on Persistence Layers tests");
		ALLPRINT(KPersistance);
		}
	else
		{
		_LIT(KLocalViewCS,"Initialising LocalView on Client/Server tests");
		ALLPRINT(KLocalViewCS);
		}
	ALLPRINT(KStars);
	InitializeL();
	iObserver->iMainFunc = mainFunc;
	CActiveScheduler::Start();

	if( !iPLView )
		{
		ALLPRINT(KStars);
		_LIT(KRemoteViewCS,"Initialising RemoteView on Client/Server tests");
		ALLPRINT(KRemoteViewCS);
		ALLPRINT(KStars);
		iRemote = ETrue;
        // Ensure that the recover is deleted before another one is created.
        EndRecoverL();
		ResetDatabaseL(10);
		iObserver->iMainFunc = mainFunc;// test to run
		iObserver->iDoFunc = NULL;
		iObserver->CleanView();
		iObserver->Activate();
		CActiveScheduler::Start();
		}

	if( !iPLView )
		{
		ALLPRINT(KStars);
		_LIT(KRemoteViewCS,"Initialising RemoteView on Client/Server tests");
		ALLPRINT(KRemoteViewCS);
		ALLPRINT(KStars);
		iRemote = ETrue;
		ResetDatabaseL(10);
		iObserver->iMainFunc = mainFunc;// test to run
		iObserver->iDoFunc = NULL;
		iObserver->CleanView();
		iObserver->Activate();
		CActiveScheduler::Start();
		}

		CleanupL();
		__UHEAP_MARKEND;

	return TestStepResult();
	}