eis/inc/base/TestMag.h

122 lines
3.2 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*********************************************************************
*
* 文 件: TestMag.h 测试管理类
*
* 版权所有: Shanghai Baosight Software Co., Ltd.
*
* 概述://TODO请添加本文件包含功能详细描述
* //TODO
* //TODO
*
* 版本历史
* 1.0 2010-08-03 tonny //TODO请添加本次主要修改内容
* %USER%
*********************************************************************/
#ifndef _APP_UNITEST_TEST_H
#define _APP_UNITEST_TEST_H
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <base/TestNode.h>
//#include <unitest/apptest.h>
using namespace std;
namespace baosight
{
class TestMag
{
public :
TestMag(int mode = 0,int column = 1);
virtual ~TestMag();
// 概述: 在运行测试用例前首先构建菜单,用户需要确保负责关系正确
void addTestCase(TestNode* child,TestNode*father=NULL);
// 概述: 运行测试用例的入口0:手工运行方式1自动运行方式
int run();
private:
/**********************************************************************
* 概述: //TODO:请添加函数描述
* 函数名: manaulTest
* 返回值: int //TODO:返回值描述
* 参数列表: 参数类型 取值范围 描述
* node : [IN/OUT] TestNode * //TODO:参数取值范围 <//TODO:参数描述>
* level : [IN/OUT] int & //TODO:参数取值范围 <//TODO:参数描述>
*
* 版本历史
* 1.0 2010-07-26 tonny //TODO请添加本次主要修改内容
*
**********************************************************************/
int manaulTest(TestNode* node,int& level);
void showLevelMenu(TestNode*father,int level);
// 概述: 以深度优先方式执行自动测试
void autoTest(TestNode* node,int level,bool allLeaf = true);
/**********************************************************************
* 概述: //TODO:请添加函数描述
* 函数名: clearNodes
* 返回值: void //TODO:返回值描述
* 参数列表: 参数类型 取值范围 描述
* father : [IN/OUT] TestNode * //TODO:参数取值范围 <//TODO:参数描述>
*
* 版本历史
* 1.0 2010-08-03 tonny //TODO请添加本次主要修改内容
*
**********************************************************************/
void clearNodes(TestNode* father);
/**********************************************************************
* 概述: 产生帮助信息
* 函数名: showHelp
* 返回值: void //TODO:返回值描述
* 参数列表: 参数类型 取值范围 描述
*
* 版本历史
* 1.0 2010-08-03 tonny //TODO请添加本次主要修改内容
*
**********************************************************************/
void showHelp();
private:
//change mode ,auto <-->manual
int changeMode(int level);
//先是命令提示符
int showTipCommand();
private:
TestNode* p_testNodes;
int m_column;
int m_mode;//0手动模式1自动模式
int m_succTestNum;
int m_failTestNum;
int m_status;
};
//测试开始
#define TEST_START TestMag* p_TestMag = new TestMag();\
//测试结束
#define TEST_END p_TestMag->run();delete p_TestMag;\
//增加根测试结点
#define TEST_ROOT_ADD(rootNode){\
p_TestMag->addTestCase(new rootNode);\
}
//增加子测试结点
#define TEST_SUB_ADD(childNode,fatherName){\
p_TestMag->addTestCase(new childNode,new fatherName);\
}
};
#endif