コード例 #1
0
/******************************************************************************
Function Name  :  bParseTestSetup
Input(s)       :  INT nIndex
Output         :  BOOL
Functionality  :  Loads The
Member of      :  CTSExecutorChildFrame
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  07/04/2011
Modifications  :
Code Tag       :
******************************************************************************/
BOOL CTSExecutorChildFrame::bParseTestSetup(INT nIndex)
{
    BOOL bResult = FALSE;
    STestSetupInfo sTSInfo;

    if( m_ouTSExecutor.GetTestSetupInfo(nIndex, sTSInfo) == S_OK)
    {
        HTREEITEM hTSItem = m_odTreeView->InsertTreeItem(m_hParentTreeItem, sTSInfo.m_omstrName, NULL, def_INDEX_TESTSETUPIMAGE,
                            def_INDEX_TESTSETUPIMAGE, sTSInfo.m_dwID);
        m_odTreeView->GetTreeCtrl().SetCheck(hTSItem, sTSInfo.m_bEnable);

        for(INT i = 0; i < sTSInfo.m_nTCCount; i++)
        {
            CBaseEntityTA* pouTCData;
            CTestCaseData ouTCData;

            if(m_ouTSExecutor.GetTestCaseInfo(sTSInfo.m_dwID, i, &pouTCData) == S_OK)
            {
                pouTCData->GetEntityData(TEST_CASE, &ouTCData);
                HTREEITEM hTCItem =  m_odTreeView->InsertTreeItem(hTSItem, ouTCData.m_omTitle, NULL, def_INDEX_TESTCASEIMAGE,
                                     def_INDEX_TESTCASEIMAGE, pouTCData->GetID());
                m_odTreeView->GetTreeCtrl().SetCheck(hTCItem, pouTCData->bGetEnableStatus());
            }
        }

        bResult = TRUE;
    }

    return bResult;
}
コード例 #2
0
ファイル: TSExecutorLIB.cpp プロジェクト: GT-Pfand/busmaster
/******************************************************************************
Function Name  :  bExecuteTestSetup
Input(s)       :  CTestSetupEntity& ouTestSetupEntity
Output         :  BOOL
Functionality  :  Executes the TestSetup
Member of      :  CTSExecutorLIB
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  07/04/2011
Modifications  :
Code Tag       :
******************************************************************************/
BOOL CTSExecutorLIB::bExecuteTestSetup(CTestSetupEntity& ouTestSetupEntity)
{
    CBaseEntityTA* pouTestCase;
    UINT unTCCount;
    //Initialise Result Information
    ouTestSetupEntity.GetSubEntryCount(unTCCount);
    ouTestSetupEntity.GetHeaderData(m_ouResult.m_ouHeaderInfo);

    ouTestSetupEntity.m_ouDataBaseManager.bFillDataStructureFromDatabaseFile(m_ouResult.m_ouHeaderInfo.m_omDatabasePath);

	//pfand: Insert hardcoded testcase here
    
	m_ouResult.m_omStrTestSetupFile = ouTestSetupEntity.m_omstrTestSetupTitle;
    m_ouResult.m_odTcResultList.RemoveAll();
    for(UINT nTCIndex=0; nTCIndex<unTCCount; ++nTCIndex)
    {

        ouTestSetupEntity.GetSubEntityObj(nTCIndex, &pouTestCase);
        if(pouTestCase->bGetEnableStatus() == TRUE)
        {
            //Start Result Update
            CTestCaseData ouTestCaseData;
            pouTestCase->GetEntityData(TEST_CASE, &ouTestCaseData);

            CResultTc ouTestCaseResult;
            ouTestCaseResult.m_omTestCase = ouTestCaseData.m_omTitle;
            ouTestCaseResult.m_omTestDescripter = "";
            GetLocalTime(&ouTestCaseResult.m_sStartTime);
            //Now Execute;
            ouTestCaseResult.m_eResult = SUCCESS;
            BOOL bResult = bExecuteTestCase(pouTestCase, ouTestCaseResult);
            if(bResult == FALSE)
            {
                //TODO:: ProperHandling Required
                ouTestCaseResult.m_eResult = ERRORS;
            }
            GetLocalTime(&ouTestCaseResult.m_sEndTime);
            m_ouResult.m_odTcResultList.AddTail(ouTestCaseResult);
        }
    }
    m_ouResult.GenerateReport();
    return TRUE;
}
コード例 #3
0
ファイル: TSExecutorLIB.cpp プロジェクト: bagge/busmaster
HRESULT CTSExecutorLIB::GetConfigurationData(xmlNodePtr pxmlNodePtr)
{
    const char* omcVarChar ;

    //<Test_Suite_Name />

    omcVarChar = m_omstrTestSuiteName.GetBuffer(MAX_PATH);

    xmlNodePtr pTSName = xmlNewChild(pxmlNodePtr, NULL, BAD_CAST DEF_TS_NAME, BAD_CAST omcVarChar);
    xmlAddChild(pxmlNodePtr, pTSName);

    // <IsEnable />
    CString csIsEnabled;
    csIsEnabled.Format("%d", m_bTestSuiteStatus);
    omcVarChar = csIsEnabled;
    xmlNodePtr pIsEnabled = xmlNewChild(pxmlNodePtr, NULL, BAD_CAST DEF_IS_ENABLE, BAD_CAST omcVarChar);
    xmlAddChild(pxmlNodePtr, pIsEnabled);

    INT nFileCount = (INT)m_ouTestSetupEntityList.GetCount();

    for(int iCnt = 0; iCnt < nFileCount; iCnt++)
    {
        //<TEST_SUITE>
        xmlNodePtr pTestSuite = xmlNewNode(NULL, BAD_CAST DEF_TEST_SUITE);
        xmlAddChild(pxmlNodePtr, pTestSuite);

        //<Test_Suite_Name />
        POSITION pos = m_ouTestSetupEntityList.FindIndex(iCnt);
        CTestSetupEntity& ouTestSetupEntity = m_ouTestSetupEntityList.GetAt(pos);

        string omPath, omStrConfigFolder;
        char configPath[MAX_PATH];
        AfxGetMainWnd()->SendMessage(MSG_GET_CONFIGPATH, (WPARAM)configPath, 0);
        CUtilFunctions::nGetBaseFolder(configPath, omStrConfigFolder );
        CUtilFunctions::MakeRelativePath(omStrConfigFolder.c_str(), (char*)ouTestSetupEntity.m_omstrCurrentTSFile.GetBuffer(MAX_PATH), omPath);
        omcVarChar = omPath.c_str();

        xmlNodePtr pFilePath = xmlNewChild(pTestSuite, NULL, BAD_CAST DEF_FILE_PATH, BAD_CAST omcVarChar);
        xmlAddChild(pTestSuite, pFilePath);

        //<IsEnable />
        CString csIsEnabled;
        csIsEnabled.Format("%d", ouTestSetupEntity.bGetEnableStatus());
        omcVarChar = csIsEnabled;
        xmlNodePtr pIsEnabled = xmlNewChild(pTestSuite, NULL, BAD_CAST DEF_IS_ENABLE, BAD_CAST omcVarChar);
        xmlAddChild(pTestSuite, pIsEnabled);

        //<Testcases_Selected>
        xmlNodePtr pTestCasesSel = xmlNewNode(NULL, BAD_CAST DEF_TEST_CASES_SEL);
        xmlAddChild(pTestSuite, pTestCasesSel);

        // <Index>1</Index>
        CString csIndex;
        bool    bStatus;
        UINT    unCount;
        ouTestSetupEntity.GetSubEntryCount(unCount);
        for(UINT j=0; j<unCount; j++)
        {
            CBaseEntityTA* pTCEntity;
            ouTestSetupEntity.GetSubEntityObj(j, &pTCEntity);
            bStatus = FALSE;
            if(pTCEntity != NULL)
            {
                bStatus = pTCEntity->bGetEnableStatus();
            }
            if( bStatus == true )
            {
                csIndex.Format("%d", j);
                omcVarChar = csIndex;
                xmlNodePtr pIndex = xmlNewChild(pTestCasesSel, NULL, BAD_CAST DEF_INDEX, BAD_CAST omcVarChar);
                xmlAddChild(pTestCasesSel, pIndex);
            }
        }
    }
    return true;
}
コード例 #4
0
ファイル: TSExecutorLIB.cpp プロジェクト: bagge/busmaster
/******************************************************************************
Function Name  :  GetConfigurationData
Input(s)       :  BYTE*& pDesBuffer, UINT& unBuffSize
Output         :  HRESULT
Functionality  :
Member of      :  CTSExecutorLIB
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  07/04/2011
Modifications  :
Code Tag       :
******************************************************************************/
HRESULT CTSExecutorLIB::GetConfigurationData(BYTE*& pDesBuffer, UINT& unBuffSize)
{
    INT nFileCount = (INT)m_ouTestSetupEntityList.GetCount();
    unBuffSize = sizeof(UINT) + sizeof(BOOL)+sizeof(char)*MAX_PATH; //Number of TestSetupFiles + Status of TestSuite+TestSuite Name

    for(INT i = 0; i < nFileCount; i++)
    {
        UINT unCount;
        GetTestcaseCount(i, unCount);
        //TestSuite Name + File Path + Selection Status + Number of TestCases + Testcases Status
        unBuffSize += (sizeof(char)*MAX_PATH + sizeof(char)*MAX_PATH) + sizeof(BOOL) + sizeof(UINT) + (unCount*sizeof(BOOL));
    }

    pDesBuffer = new BYTE[unBuffSize];

    if (pDesBuffer != NULL)
    {
        BYTE* pbyTemp = pDesBuffer;
        //TestSuite name
        char acTestSuiteName[MAX_PATH] = {_T('\0')};
        strcpy_s(acTestSuiteName, MAX_PATH, m_omstrTestSuiteName);
        COPY_DATA(pbyTemp, acTestSuiteName, (sizeof (char) * MAX_PATH));
        //TestSuite Status
        COPY_DATA(pbyTemp, &m_bTestSuiteStatus, sizeof(BOOL));

        //File Count
        COPY_DATA(pbyTemp, &nFileCount, sizeof(INT));


        for(INT i = 0; i < nFileCount; i++)
        {
            UINT unCount;
            POSITION pos = m_ouTestSetupEntityList.FindIndex(i);
            CTestSetupEntity& ouTestSetupEntity = m_ouTestSetupEntityList.GetAt(pos);

            //File Path
            char acName[MAX_PATH] = {_T('\0')};
            strcpy_s(acName, MAX_PATH, ouTestSetupEntity.m_omstrCurrentTSFile.GetBuffer(MAX_PATH));
            COPY_DATA(pbyTemp, acName, (sizeof (char) * MAX_PATH));
            //Selection Status
            BOOL bStatus = ouTestSetupEntity.bGetEnableStatus();
            COPY_DATA(pbyTemp, &bStatus, sizeof(BOOL));

            //TestCase Count
            ouTestSetupEntity.GetSubEntryCount(unCount);
            COPY_DATA(pbyTemp, &unCount, sizeof(UINT));

            //TestCase Selection Status
            for(UINT j=0; j<unCount; j++)
            {
                CBaseEntityTA* pTCEntity;
                ouTestSetupEntity.GetSubEntityObj(j, &pTCEntity);
                bStatus = FALSE;
                if(pTCEntity != NULL)
                {
                    bStatus = pTCEntity->bGetEnableStatus();
                }
                COPY_DATA(pbyTemp, &bStatus, sizeof(BOOL));
            }
            //File Path + Selection Status + Number of TestCases + Testcases Status
        }
    }
    return S_OK;
}