基于GUI的测试
新建一个基于dialog的项目 插入你要测试的类或方法的源文件。 修改App类中的Instance方法 添加下列头文件#include <cppunit/ui/mfc/TestRunner.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include "xxxSuite.h"
CCPlusTestDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
CppUnit::MfcUi::TestRunner runner;
runner.addTest(xxxSuite::suite()); //添加测试
runner.run(); //show UI
本文地址:http://com.8s8s.com/it/it25889.htm