⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 buildrundlglistener.cpp

📁 自动化编译工具代码
💻 CPP
字号:
// BuildRunDlgListener.cpp: implementation of the CBuildRunDlgListener class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "BuildRunDlgListener.h"

#include "resultxsd.h"
#include "Common.h"

#include "AutoBuildSystemDlg.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CBuildRunDlgListener::CBuildRunDlgListener(CAutoBuildSystemDlg *pReportDlg)
	:m_pReprotDlg(pReportDlg)
{
	ASSERT(m_pReprotDlg->GetSafeHwnd() != NULL);
}

CBuildRunDlgListener::~CBuildRunDlgListener()
{

}

void CBuildRunDlgListener::ReportExecStepMsg(ExecStepMsg msg)
{
	const CString strMsg = GetMsgText(msg);

	m_pReprotDlg->m_strProcessMsg += (strMsg + "\r\n");
	m_pReprotDlg->UpdateData(FALSE);
}

/*    
--------------------------SUCCESSED----------------------------------
VSSPath			= $/Test/TestProjectVC2005
ProjectName		= TestProjectVC2005
---------------------------------------------------------------------
--------------------------FAILED-------------------------------------
VSSPath			= $/Test/TestProjectVC6
ProjectName		= TestProjectVC6
TestCount		= 10
FailTest		= 1
ProjectTempDir	= D:\TestDB\Project\133236781
TestResultFile	= D:\TestDB\Project\133236781\TestReport\tests.xml
---------------------------------------------------------------------
                                                                  */
//--------------------------------------------------------------------------
//								Default
//--------------------------------------------------------------------------
// 分析测试结果报告
BOOL CBuildRunDlgListener::ReportExecResult(const CString &strTestResultFile,
									 CTestProjectType project)
{
	CString strReportMsg;

	CString strVSSPath			= project.GetVSSPath();
	CString strProjectName		= project.GetProjectName();

	CresultxsdDoc	doc;
	CTestRunType	root	= doc.Load(strTestResultFile);
	CStatisticsType statis	= root.GetStatistics();
	if (statis.GetFailures() > 0)	// 错误
	{
		CFailedTestsType failtests = root.GetFailedTests();

		int		nTests				= statis.GetTests();
		int		nFailures			= statis.GetFailures();
		CString strProjectTempDir	= CCommon::GetDirFrontDirPath(CCommon::GetFilePath(strTestResultFile));
		strReportMsg.Format(
			"\r\n---------------------------Fails---------------------------"
			"\r\nVSSPath        = %s"
			"\r\nProjectName    = %s"
			"\r\nProjectTempDir = %s"
			"\r\nTestResultFile = %s"
			"\r\n"
			"\r\n------------------ %d test(s), %d fails(s) ------------------"
			"\r\n"
				,strVSSPath
				,strProjectName
				,strProjectTempDir
				,strTestResultFile
				,nTests
				,nFailures
				);
	}
	/* 这中间还有"异常" */
	else						// 成功
	{
		strReportMsg.Format(
			"--------------------------Successed--------------------------"
			"\r\nVSSPath         = %s"
			"\r\nProjectName     = %s"
			"\r\n"
				,strVSSPath
				,strProjectName);
	}

	m_pReprotDlg->m_strResultMsg += strReportMsg;
	m_pReprotDlg->UpdateData(FALSE);

	return statis.GetFailures() == 0;
}

void CBuildRunDlgListener::Clean()
{
	m_pReprotDlg->m_strResultMsg  = "";
	m_pReprotDlg->m_strProcessMsg = "";
	m_pReprotDlg->UpdateData(FALSE);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -