コード例 #1
0
/******************************************************************************
Function Name  :  ValidateEntity
Input(s)       :  
Output         :  HRESULT
Functionality  :   
Member of      :  CTestCaseEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  13/04/2011
Modifications  :  
Code Tag       :  CS028
******************************************************************************/
HRESULT CTestCaseEntity::ValidateEntity(CString& omStrResult)
{
    UINT unTestCaseCount;
    CString omStrTemp;
    GetSubEntryCount(unTestCaseCount);
    
    HRESULT hResult = ERR_VALID_SUCCESS;
    if(unTestCaseCount == 0)
    {
        omStrTemp.Format("\tError: Atleast One Verify Node Should be Defined\r\n");
        hResult = ERR_VALID_ERROR;      //CS028
    }
    else
    {
        BOOL bVerifyEntityFound = FALSE;
        //omStrTemp = "\t";
        for(UINT i = 0; i < unTestCaseCount; i++)
        {
            CString omStrTCResult;
            CBaseEntityTA* pTCSubEntity;
            if(GetSubEntityObj(i, &pTCSubEntity) == S_OK)
            {
                omStrTCResult.Format(_T("Node %d:"), i+1);
                HRESULT hTempResult = pTCSubEntity->ValidateEntity(omStrTCResult);
                if(hTempResult != ERR_VALID_SUCCESS)
                {   
                    omStrTemp += "\t" + omStrTCResult;
                    if(hResult != ERR_VALID_ERROR)
                    {
                        hResult = hTempResult;
                    }
                }
                if(pTCSubEntity->GetEntityType() == VERIFY)
                {
                    bVerifyEntityFound = TRUE;
                }
                
            }
        }
        if(bVerifyEntityFound == FALSE)
        {
            omStrTemp += "\tError: No Verify Entity Found\r\n";
            hResult = ERR_VALID_ERROR;
        }
    }
    if(hResult != ERR_VALID_SUCCESS)
    {
        omStrResult.Format(_T("TestCase %s Result \r\n"), m_ouData.m_omTitle);
        omStrResult += omStrTemp + "\n";
    }
    return hResult;
}
コード例 #2
0
ファイル: TSExecutorLIB.cpp プロジェクト: bagge/busmaster
/******************************************************************************
Function Name  :  bExecuteTestCase
Input(s)       :  CBaseEntityTA* pTCEntity, CResultTc& ouTestCaseResult
Output         :  BOOL
Functionality  :  Executes the TestCase
Member of      :  CTSExecutorLIB
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  07/04/2011
Modifications  :
Code Tag       :  CS041
******************************************************************************/
BOOL CTSExecutorLIB::bExecuteTestCase(CBaseEntityTA* pTCEntity, CResultTc& ouTestCaseResult)
{
    if(g_podTSExecutor == NULL)
    {
        return NULL;
    }
    CBaseEntityTA* pEntity;
    CString omStrTilte;
    CString omStrID;
    eACTION_EXCP eExp;
    CString omStrDisplayMsg;
    BOOL bResult = TRUE;
    ouTestCaseResult.m_ouVerifyList.RemoveAll();

    ((CTestCaseEntity*)pTCEntity)->GetTestCaseDetails(omStrTilte, omStrID, eExp);
    int nCurrentRow = m_ompResultDisplayWnd->GetItemCount();
    m_ompResultDisplayWnd->InsertItem(nCurrentRow, omStrTilte);

    UINT unCount;
    pTCEntity->GetSubEntryCount(unCount);
    for(UINT unIndex = 0; unIndex < unCount; unIndex++)
    {
        nCurrentRow = m_ompResultDisplayWnd->GetItemCount();
        m_ompResultDisplayWnd->InsertItem(nCurrentRow, "");
        pTCEntity->GetSubEntityObj(unIndex, &pEntity);
        switch(pEntity->GetEntityType())
        {
            case SEND:
            {
                m_ompResultDisplayWnd->SetItemText(nCurrentRow, 1, "Sending Messages Started");
                g_podTSExecutor->TSX_SendMessage(pEntity);
            }
            break;
            case VERIFY:
            {
                m_ompResultDisplayWnd->SetItemText(nCurrentRow, 1, "Verifying Started");
                CResultVerify ouVerifyResult;
                if(g_podTSExecutor->TSX_VerifyMessage(pEntity, ouVerifyResult) == S_FALSE)
                {
                    bResult = FALSE;
                }
                ouTestCaseResult.m_ouVerifyList.AddTail(ouVerifyResult);
            }
            break;
            case WAIT:
            {
                CString omStrTemp;
                CWaitEntityData ouWaitData;
                pEntity->GetEntityData(WAIT, &ouWaitData);
                omStrTemp.Format("Waiting %d msec for %s", ouWaitData.m_ushDuration, ouWaitData.m_omPurpose);
                m_ompResultDisplayWnd->SetItemText(nCurrentRow, 1, omStrTemp);
                Sleep(ouWaitData.m_ushDuration);
            }
            break;
            case VERIFYRESPONSE:
            {
                m_ompResultDisplayWnd->SetItemText(nCurrentRow, 1, "VerifyRequest Started");
                CResultVerify ouVerifyResult;
                if(g_podTSExecutor->TSX_VerifyResponse(pEntity, ouVerifyResult) == S_FALSE)
                {
                    bResult = FALSE;
                }
                ouTestCaseResult.m_ouVerifyList.AddTail(ouVerifyResult);
            }
            break;
            default:
                break;
        }
        if(bResult == FALSE && eExp == EXIT)
        {
            break;
        }
    }
    return bResult;
}