当前位置: 首页>>代码示例>>C++>>正文


C++ TestRunner::addSuite方法代码示例

本文整理汇总了C++中TestRunner::addSuite方法的典型用法代码示例。如果您正苦于以下问题:C++ TestRunner::addSuite方法的具体用法?C++ TestRunner::addSuite怎么用?C++ TestRunner::addSuite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestRunner的用法示例。


在下文中一共展示了TestRunner::addSuite方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main()
{
	//
    // Set the run time parameters.
	//

	// need to adjust this db connection parameter accordingly
    TA_Base_Core::RunParams::getInstance().set( RPARAM_DBCONNECTION, "TRA_DEV2:unittest:unittest" );

	// need to adjust this notify hosts parameter accordingly
	TA_Base_Core::RunParams::getInstance().set( RPARAM_NOTIFYHOSTS, "10.205.81.35:6668,10.205.81.35" );	

	// all these parameters can be set via the "dummy system controller" process
    //TA_Base_Core::RunParams::getInstance().set( RPARAM_LOCATIONKEY, "1" );
    //TA_Base_Core::RunParams::getInstance().set( RPARAM_MGRPORT, "9999" );
	//TA_Base_Core::RunParams::getInstance().set( RPARAM_MGRPORT, "6668" );
    //TA_Base_Core::RunParams::getInstance().set( RPARAM_OPERATIONMODE, "Control" );

    TA_Base_Core::DebugUtil::getInstance().setFile( "DataPointBulkInterfaceTest.log" );
    TA_Base_Core::RunParams::getInstance().set( "DebugAlwaysTrueRightsLib", "true" );

    // create test runner
    TestRunner runner;

	// create stubs
    DbManager * db = 0;;
    DataPointAgent * dataPointAgent = 0;
	DataPointAgentClient * dataPointAgentClient = 0;

    try
    {
        // Prepare the database.
		db = new DbManager();
		db->removeEntities();
        db->addEntities();

        // create the agent that loads the DataPoints.
		TA_Base_Core::RunParams::getInstance().set( RPARAM_ENTITYNAME, db->AgentName.c_str() );
        dataPointAgent = new DataPointAgent ( db->AgentName );
        dataPointAgent->startAgent();

		// create DataPointAgentClient
		dataPointAgentClient = new DataPointAgentClient ( db->AgentName );

        // Test all public DataPoint members using a BooleanData point.
        DataPointBulkInterfaceTest testcase1 ( "DataPointBulkInterfaceTest", db, dataPointAgent, dataPointAgentClient );
        runner.addSuite( testcase1.suite() );

        // Run the tests defined in the config file
        runner.begin( "./cfg/config.ini" );
    }
    catch ( TA_Base_Core::TransactiveException& ex )
    {
        std::cout << "TransactiveException: " << ex.what() << std::endl;
    }
    catch ( ... )
    {
		std::cout << "Caught an unknown exception" << std::endl;
	}

    // Terminate the agent
	if ( 0 != dataPointAgent )
	{
		dataPointAgent->terminateAndWait();

		dataPointAgent->deactivateAndDeleteServant();
		dataPointAgent = 0;
	}

	// Clean up the agent client
	if ( 0 != dataPointAgentClient )
	{
		delete dataPointAgentClient;
		dataPointAgentClient = 0;
	}

    // Clean up the database.
	if ( 0 != db )
	{
		db->removeEntities();
		delete db;
		db = 0;
	}

    return 0;
}
开发者ID:hajuli,项目名称:test_codes,代码行数:86,代码来源:main.cpp


注:本文中的TestRunner::addSuite方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。