예제 #1
0
/******************************************************************************
Function Name  :  RepositionSubEntity
Input(s)       :  CBaseEntityTA* pouRefSubEntity
                  CBaseEntityTA* pouCurrSubEntity
Output         :  HRESULT - returns the New Entity ID
Functionality  :  Reposition pouRefSubEntity after pouCurrSubEntity
Member of      :  CTestCaseEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :  
Codetag        :  CS021
******************************************************************************/
HRESULT CTestCaseEntity::RepositionSubEntity(CBaseEntityTA* pouRefSubEntity, CBaseEntityTA* pouCurrSubEntity)
{
    //DESIGN:: First Take copy of Data and delete it from current position and add at required place 
    UINT unCount = (UINT)m_ouData.m_odTAEntityList.GetCount();
    for(UINT i=0; i<unCount; i++)
    {
        POSITION pos = m_ouData.m_odTAEntityList.FindIndex(i);
        CBaseEntityTA* pEntity = m_ouData.m_odTAEntityList.GetAt(pos);
        if(pEntity->GetID() == pouRefSubEntity->GetID())
        {
            m_ouData.m_odTAEntityList.RemoveAt(pos);
            break;
        }
    }
    if(pouCurrSubEntity == NULL)        //Insert At First Index;
    {
        m_ouData.m_odTAEntityList.AddHead(pouRefSubEntity);
    }
    
    else
    {
        for(UINT i=0; i<unCount; i++)
        {
            POSITION pos = m_ouData.m_odTAEntityList.FindIndex(i);
            CBaseEntityTA* pEntity = m_ouData.m_odTAEntityList.GetAt(pos);
            if(pEntity->GetID() == pouCurrSubEntity->GetID())
            {
                m_ouData.m_odTAEntityList.InsertAfter(pos, pouRefSubEntity);
                break;
            }
        }
    }
    return pouRefSubEntity->GetID();
}
예제 #2
0
/******************************************************************************
Function Name  :  EnableTestCase
Input(s)       :  DWORD dwID, UINT unIndex, BOOL bEnable
Output         :  HRESULT
Functionality  :  Enables or disable the Testcase with index unIndex in
                  test setup with id dwID
Member of      :  CTSExecutorLIB
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  07/04/2011
Modifications  :
Code Tag       :
******************************************************************************/
HRESULT CTSExecutorLIB::EnableTestCase( DWORD dwID, UINT unIndex, BOOL bEnable)
{
    BOOL bValidID = FALSE;
    HRESULT hResult = ERR_WRONG_ID;
    INT nCount = (INT)m_ouTestSetupEntityList.GetCount();
    CBaseEntityTA* pTCInfo;
    for(int i = 0; i < nCount; i++)
    {
        POSITION pos = m_ouTestSetupEntityList.FindIndex(i);
        CTestSetupEntity& ouTempTestSetup = m_ouTestSetupEntityList.GetAt(pos);
        if(ouTempTestSetup.GetID() == dwID)
        {
            hResult = S_OK;
            if(ouTempTestSetup.GetSubEntityObj(unIndex, &pTCInfo) == S_OK)
            {
                pTCInfo->vEnableEntity(bEnable);
                break;
            }
            else
            {
                hResult = ERR_WRONG_INDEX;
                break;
            }
        }
    }
    return hResult;
}
예제 #3
0
/******************************************************************************
Function Name  :  ValidateEntity
Input(s)       :  
Output         :  HRESULT
Functionality  :   
Member of      :  CTestSetupEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  13/04/2011
Modifications  :  
Code Tag       :  CS026
******************************************************************************/
HRESULT CTestSetupEntity::ValidateEntity(CString& omStrResult)
{
    UINT unCount;
    GetSubEntryCount(unCount);
    CString omStrHeaderResult;
    HRESULT hResult = ERR_VALID_SUCCESS;

    if(m_ouTestSetupHeader.ValidateEntity(omStrHeaderResult) == ERR_VALID_ERROR)
    {
        omStrResult += omStrHeaderResult;
        hResult = ERR_VALID_ERROR;
    }

    if(unCount <=0 )
    {
        omStrResult += _T("No TestCases Are Defined\r\n");
        hResult = ERR_VALID_ERROR;
    }
    else
    {
        for(UINT i=0; i<unCount; i++)
        {
            CString omStrTcResult;
            CBaseEntityTA* pTcEntity;
            GetSubEntityObj(i, &pTcEntity);
            if(pTcEntity->ValidateEntity(omStrTcResult) == ERR_VALID_ERROR) 
            {
                hResult = ERR_VALID_ERROR;
            }
            omStrResult += omStrTcResult;
        }
    }
    return hResult;
}
/******************************************************************************
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;
}
예제 #5
0
void CTestSetupEntity::vDeleteAllSubMessages()
{
    INT lCount = (INT)m_odTestCaseEntityList.GetCount();
    for(int i=0; i<lCount; i++)
    {
        POSITION pos = m_odTestCaseEntityList.FindIndex(i);
        CTestCaseEntity& odTestCaseEntity = m_odTestCaseEntityList.GetAt(pos);

        UINT nSubCount = 0;
        odTestCaseEntity.GetSubEntryCount(nSubCount);

        for( int j = 0; j < nSubCount; j++ )
        {
            CBaseEntityTA* pEntity;
            odTestCaseEntity.GetSubEntityObj(j, &pEntity);
            if( nullptr != pEntity )
            {
                UINT nSubChildCount = 0;
                pEntity->GetSubEntryCount(nSubChildCount);
                for ( int k = 0; k < nSubChildCount; k++ )
                {
                    pEntity->DeleteSubEntry(0);
                }
            }
        }
    }
}
예제 #6
0
/******************************************************************************
Function Name  :  EnableItem
Input(s)       :  DWORD dwID, BOOL& bEnable
Output         :  HRESULT
Functionality  :  Enable or disables the entity
Member of      :  CTSExecutorLIB
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  07/04/2011
Modifications  :
Code Tag       :
******************************************************************************/
HRESULT CTSExecutorLIB::EnableItem(DWORD dwID, BOOL& bEnable)
{
    HRESULT hResult = ERR_WRONG_ID;
    if(dwID == def_ID_TESTSUITE)
    {
        m_bTestSuiteStatus = bEnable;
        hResult= S_OK;
    }
    else
    {
        INT nCount = (INT)m_ouTestSetupEntityList.GetCount();
        for(INT i=0; i<nCount; i++)
        {
            POSITION pos = m_ouTestSetupEntityList.FindIndex(i);
            CTestSetupEntity& ouTempTestSetup = m_ouTestSetupEntityList.GetAt(pos);
            CBaseEntityTA* pEntity;
            ouTempTestSetup.SearchEntityObject(dwID, &pEntity);
            if(pEntity != NULL)
            {
                pEntity->vEnableEntity(bEnable);
                hResult= S_OK;
            }
        }
    }
    return  hResult;
}
예제 #7
0
/******************************************************************************
Function Name  :  TSX_VerifyMessage
Input(s)       :
Output         :  HRESULT
Functionality  :
Member of      :  CTSExecutionCAN
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  01/04/2011
Modifications  :
******************************************************************************/
HRESULT CTSExecutionCAN::TSX_VerifyMessage(CBaseEntityTA* pEntity, CResultVerify& ouVerifyResult)
{
    //TODO::Proper Handling Required
    UCHAR* pucData;
    STCANDATA sCanData;
    UINT unVerifyCount;
    HRESULT hResult = S_OK;
    CBaseEntityTA* pVerifyEntity;
    CVerify_MessageData ouVerifyData;
    CString omResult;
    sMESSAGE sMsg;
    CSignalInfoArray ouSignalInfo;
    pEntity->GetSubEntryCount(unVerifyCount);
    ouVerifyResult.m_MessageResultList.RemoveAll();

    //Loop For all Messages
    for(UINT j=0; j<unVerifyCount; j++)
    {
        pEntity->GetSubEntityObj(j, &pVerifyEntity);
        pVerifyEntity->GetEntityData(VERIFY_MESSAGE, &ouVerifyData);

        if(m_ouCanBufVFSE.ReadFromBuffer(&sCanData, (__int64)ouVerifyData.m_dwMessageID)==0)
        {
            pucData = new UCHAR[sCanData.m_uDataInfo.m_sCANMsg.m_ucDataLen];
            memcpy(pucData, &sCanData.m_uDataInfo.m_sCANMsg.m_ucData, sCanData.m_uDataInfo.m_sCANMsg.m_ucDataLen);
        }
        else
        {
            pucData = new UCHAR[8];
            memset(pucData, 0, 8);
        }

        //Interprete The Messages
        SMSGENTRY* sMsgEntry = new SMSGENTRY;
        pEntity->m_ouDataBaseManager.nGetMessageInfo(ouVerifyData.m_omMessageName, sMsg);
        sMsgEntry->m_psMsg = &sMsg;
        sMsgEntry->m_psNext = NULL;
        m_ouMsgInterpret.vSetMessageList(sMsgEntry);
        m_ouMsgInterpret.bInterpretMsgs(ouVerifyData.m_dwMessageID, pucData, ouSignalInfo);
        CString strVerDisplay = "Verifying Message "+ouVerifyData.m_omMessageName;
        TSX_DisplayMessage(strVerDisplay);
        //Verify The Signals
        CMessageResult ouMsgResult;
        omResult = "SUCCESS";

        if( bVerifyCanMessage(ouVerifyData, ouSignalInfo, ouMsgResult) == FALSE)
        {
            omResult = "FAIL";
            hResult = S_FALSE;
        }

        ouVerifyResult.m_MessageResultList.AddTail(ouMsgResult);
        TSX_DisplayResult(omResult);
        delete []pucData;
    }

    return hResult;
}
예제 #8
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;
}
예제 #9
0
/******************************************************************************
Function Name  :  SetData
Input(s)       :  MSXML2::IXMLDOMElementPtr& pIDomTestCaseNode
Output         :  HRESULT
Functionality  :   
Member of      :  CTestCaseEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :  
******************************************************************************/
HRESULT CTestCaseEntity::SetData(MSXML2::IXMLDOMElementPtr& pIDomTestCaseNode)
{
    CString omstrTemp;
    MSXML2::IXMLDOMDocumentPtr pIDOMDoc;
    pIDOMDoc.CreateInstance(L"Msxml2.DOMDocument");
    
    MSXML2::IXMLDOMAttributePtr pIDomTSAtrrib = pIDOMDoc->createAttribute(def_STR_TCATTRIB_ID);
    if(pIDomTSAtrrib!= NULL)
	{
        pIDomTSAtrrib->value = _bstr_t(m_ouData.m_omID);
		pIDomTestCaseNode->setAttributeNode(pIDomTSAtrrib);
	}

    pIDomTSAtrrib = pIDOMDoc->createAttribute(def_STR_TCATTRIB_TITLE);
    if(pIDomTSAtrrib!= NULL)
	{
        pIDomTSAtrrib->value = _bstr_t(m_ouData.m_omTitle);
		pIDomTestCaseNode->setAttributeNode(pIDomTSAtrrib);
	}

    pIDomTSAtrrib = pIDOMDoc->createAttribute(def_STR_TCATTRIB_H_EXP);
    if(pIDomTSAtrrib!= NULL)
	{
        switch(m_ouData.m_eExcpAction)
        {
            case EXIT:
                omstrTemp = "EXIT";
                break;
            case CONTINUE:
            default:
                omstrTemp = "CONTINUE";
                break;
        }
        pIDomTSAtrrib->value = _bstr_t(omstrTemp);
		pIDomTestCaseNode->setAttributeNode(pIDomTSAtrrib);
	}

    INT lCount = (INT)m_ouData.m_odTAEntityList.GetCount();
    for(int i=0; i<lCount;i++)
    {
        POSITION pos = m_ouData.m_odTAEntityList.FindIndex(i);
        CBaseEntityTA* pEntity = m_ouData.m_odTAEntityList.GetAt(pos);
        pEntity->SetData(pIDomTestCaseNode);
    }
    
    
    return 0;
}
예제 #10
0
/******************************************************************************
Function Name  :  DeleteSubEntry
Input(s)       :  CBaseEntityTA* pouSubEntryObj
Output         :  HRESULT
Functionality  :  Deletes a Subentry 
Member of      :  CTestCaseEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :  
Codetag        :  CS018
******************************************************************************/
HRESULT CTestCaseEntity::DeleteSubEntry(CBaseEntityTA* pouSubEntryObj)
{
    HRESULT hResult  = S_FALSE;
    INT nCount = (INT)m_ouData.m_odTAEntityList.GetCount();
    for(int i = 0; i < nCount; i++)
    {
        POSITION pos = m_ouData.m_odTAEntityList.FindIndex(i);
        CBaseEntityTA *pEntity = m_ouData.m_odTAEntityList.GetAt(pos);
        if(pEntity->GetID() == pouSubEntryObj->GetID())
        {
            m_ouData.m_odTAEntityList.RemoveAt(pos);
            hResult = S_OK;
            break;
        }
    }
    return hResult;
}
예제 #11
0
/******************************************************************************
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;
}
예제 #12
0
/******************************************************************************
Function Name  :  TSX_SendMessage
Input(s)       :
Output         :  HRESULT
Functionality  :
Member of      :  CTSExecutionCAN
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  01/04/2011
Modifications  :
******************************************************************************/
HRESULT CTSExecutionCAN::TSX_SendMessage(CBaseEntityTA* pEntity)
{
    UCHAR aucData[8];
    CBaseEntityTA* pSendEntity;
    UINT unSendCount;
    pEntity->GetSubEntryCount(unSendCount);
    for(UINT j=0; j<unSendCount; j++)
    {

        STCAN_MSG stCanData;
        CSend_MessageData ouSendData;
        pEntity->GetSubEntityObj(j, &pSendEntity);
        pSendEntity->GetEntityData(SEND_MESSAGE, &ouSendData);
        sMESSAGE* pMsg = pEntity->m_ouDataBaseManager.unGetMsg(ouSendData.m_dwMessageID);
        bMakeCanMessage(pMsg, ouSendData, aucData, stCanData);
        CString strSendDisplay = _("Sending Message ")+ouSendData.m_omMessageName;
        TSX_DisplayMessage(strSendDisplay);
        m_pouDIL_CAN->DILC_SendMsg(m_dwClientId, stCanData);
    }
    return S_OK;
}
예제 #13
0
/******************************************************************************
Function Name  :  SearchEntityObject
Input(s)       :  DWORD dwId - ID of the Entity
                  CBaseEntityTA** pEnityObject - entity object
Output         :  HRESULT - S_OK if the ID is Found
Functionality  :  Retrives the entity of the Given ID.
Member of      :  CBaseEntityTA
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :
******************************************************************************/
HRESULT CBaseEntityTA::SearchEntityObject(DWORD dwId, CBaseEntityTA** pEnityObject)
{
    *pEnityObject = NULL;

    if( GetID() == dwId)
    {
        *pEnityObject = this;
    }
    else
    {
        UINT unSubEntities = 0;
        GetSubEntryCount(unSubEntities);
        for( UINT i = 0; (i < unSubEntities)&&(*pEnityObject == NULL); i++)
        {
            CBaseEntityTA* pouSubEntityObj = NULL;
            GetSubEntityObj(i, &pouSubEntityObj);
            pouSubEntityObj->SearchEntityObject(dwId, pEnityObject);
        }
    }
    return S_OK;
}
예제 #14
0
/******************************************************************************
Function Name  :  GetData
Input(s)       :  MSXML2::IXMLDOMNodePtr& pIDomNode
Output         :  HRESULT
Functionality  :  Fills the datastructure from the XML node 
Member of      :  CTestCaseEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :  
******************************************************************************/
HRESULT CTestCaseEntity::GetData(MSXML2::IXMLDOMNodePtr& pIDomNode)
{
//Getting Attributes
    _bstr_t bstrNodeName;
    CComVariant NodeValue;	
    MSXML2::IXMLDOMNamedNodeMapPtr pDOMTCAtrributes;
    pDOMTCAtrributes = pIDomNode->Getattributes();
    MSXML2::IXMLDOMNodePtr pIDOMChildNode;

    //bstrNodeName = L"identifier";
	bstrNodeName.Assign(SysAllocString(CT2W("identifier")));
    pIDOMChildNode = pDOMTCAtrributes->getNamedItem(bstrNodeName);
    pIDOMChildNode->get_nodeTypedValue(&NodeValue);		
	m_ouData.m_omID = strCopyBSTRToCString(NodeValue);
    pIDOMChildNode.Release();
    
    //bstrNodeName = L"title";
	bstrNodeName.Assign(SysAllocString(CT2W("title")));
    pIDOMChildNode = pDOMTCAtrributes->getNamedItem(bstrNodeName);
    pIDOMChildNode->get_nodeTypedValue(&NodeValue);		
	m_ouData.m_omTitle = strCopyBSTRToCString(NodeValue);
    pIDOMChildNode.Release();

    //bstrNodeName = L"exp_handler";
	bstrNodeName.Assign(SysAllocString(CT2W("exp_handler")));
    pIDOMChildNode = pDOMTCAtrributes->getNamedItem(bstrNodeName);
    pIDOMChildNode->get_nodeTypedValue(&NodeValue);
	CString strTemp;	
	strTemp = strCopyBSTRToCString(NodeValue);
    pIDOMChildNode.Release();
    
    if(strTemp == "CONTINUE")
    {
        m_ouData.m_eExcpAction = CONTINUE;
    }
    else
    {
        m_ouData.m_eExcpAction = EXIT;
    }

//Getting Testcases
    MSXML2::IXMLDOMNodeListPtr pDOMChildList = pIDomNode->GetchildNodes();
    LONG lCount;
    pDOMChildList->get_length(&lCount);
    CComBSTR NodeName;
    for(int i = 0;i < lCount; i++)
    {
        pIDOMChildNode = pDOMChildList->Getitem(i);
        pIDOMChildNode->get_nodeName(&NodeName);        
		
        CBaseEntityTA *odpBaseEntity = NULL;
		if(NodeName == def_STR_SEND_NODE)
        {
            odpBaseEntity = new CSendEntity();
        }
        else if(NodeName == def_STR_VERIFY_NODE)
        {
            odpBaseEntity = new CVerifyEntity();
        }
        else if(NodeName == def_STR_WAIT_NODE)
        {
            odpBaseEntity = new CWaitEntity();
        }
        else if(NodeName == def_STR_REPLAY_NODE)
        {
            odpBaseEntity = new CReplayEntity();
        }
        else if(NodeName == def_STR_VERIFYRES_NODE)
        {
            odpBaseEntity = new CVerifyResponse();
        }
        if(odpBaseEntity == NULL)
        {
            //TODO::return a correct value
            return -1;
        }
        odpBaseEntity->GetData(pIDOMChildNode);
        m_ouData.m_odTAEntityList.AddTail(odpBaseEntity);
        //pIDOMChildNode->Release();
    }
    return S_OK;
}
예제 #15
0
HRESULT CTSExecutorLIB::SetConfigurationData(xmlNodePtr pXmlNode)
{
    xmlXPathObjectPtr pObjectPtr = NULL;
    xmlNodePtr pTempNode;
    //Test Suite Name
    m_omstrTestSuiteName = def_STR_TESTSUITENAME;

    pObjectPtr = xmlUtils::pGetChildNodes(pXmlNode, (xmlChar*)"Test_Suite_Name");
    if( NULL != pObjectPtr)
    {
        pTempNode = pObjectPtr->nodesetval->nodeTab[0];
        m_omstrTestSuiteName = (char*)xmlNodeListGetString(pTempNode->doc, pTempNode->children, 1);

        xmlXPathFreeObject(pObjectPtr);
        pObjectPtr = NULL;
    }
    //Test Suite Enable
    pObjectPtr = xmlUtils::pGetChildNodes(pXmlNode, (xmlChar*)"IsEnable");
    m_bTestSuiteStatus = TRUE;
    if( NULL != pObjectPtr)
    {
        pTempNode = pObjectPtr->nodesetval->nodeTab[0];
        char* pchKey = (char*)xmlNodeListGetString(pTempNode->doc, pTempNode->children, 1);
        if(pchKey != NULL)
        {
            m_bTestSuiteStatus = xmlUtils::bGetBooleanValue(pchKey);
            xmlFree(pchKey);
        }
        xmlXPathFreeObject(pObjectPtr);
        pObjectPtr = NULL;
    }

    //Test Suite FileCount
    int nFileCount = 0;
    pObjectPtr = xmlUtils::pGetChildNodes(pXmlNode, (xmlChar*)"TEST_SUITE");

    if( NULL != pObjectPtr)
    {
        nFileCount = pObjectPtr->nodesetval->nodeNr;
        INT nFileIndex = 0;
        for( int i = 0; i < nFileCount; i++ )
        {
            sTestSuiteConfigInfo sConfigInfo;
            if ( S_OK == nParseTestSuite(pObjectPtr->nodesetval->nodeTab[i], sConfigInfo) )
            {
                DWORD dwID;
                UINT unCount;
                if(AddTestSetup(sConfigInfo.m_strFileName.c_str(), dwID) == S_OK)
                {
                    //Selection Status
                    BOOL bStatus;
                    POSITION pos = m_ouTestSetupEntityList.FindIndex(nFileIndex++);
                    if(pos != NULL)
                    {
                        CTestSetupEntity& ouTestSetupEntity = m_ouTestSetupEntityList.GetAt(pos);
                        ouTestSetupEntity.vEnableEntity(sConfigInfo.m_bEnable);

                        //TestCase Count
                        ouTestSetupEntity.GetSubEntryCount(unCount);

                        for(UINT j=0; j<unCount; j++)
                        {
                            CBaseEntityTA* pTCEntity;
                            ouTestSetupEntity.GetSubEntityObj(j, &pTCEntity);
                            if(pTCEntity != NULL)
                            {
                                pTCEntity->vEnableEntity(FALSE);
                            }
                        }

                        //TestCase Selection Status

                        list<int>::iterator listIterator = sConfigInfo.m_nListSelctedCases.begin();

                        for(listIterator = sConfigInfo.m_nListSelctedCases.begin();
                                listIterator != sConfigInfo.m_nListSelctedCases.end(); listIterator++)
                        {
                            //MVN::Crash Issue
                            CBaseEntityTA* pTCEntity = NULL;
                            int nIndex = *listIterator;
                            HRESULT hValue = ouTestSetupEntity.GetSubEntityObj(nIndex, &pTCEntity);
                            if(pTCEntity != NULL && hValue == S_OK)
                            {
                                pTCEntity->vEnableEntity(TRUE);
                            }
                            //~MVN::Crash Issue
                        }
                    }
                }
            }
        }
    }
    return S_OK;
}
예제 #16
0
/******************************************************************************
Function Name  :  SetConfigurationData
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::SetConfigurationData(BYTE* pSrcBuffer, UINT /*unBuffSize*/)
{

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

    if (pSrcBuffer != NULL)
    {
        BYTE* pbyTemp = pSrcBuffer;
        //File Path
        char acTestSuiteName[MAX_PATH] = {_T('\0')};
        COPY_DATA_2(acTestSuiteName, pbyTemp, (sizeof (char) * MAX_PATH));
        m_omstrTestSuiteName = acTestSuiteName;

        //TestSuite Status
        COPY_DATA_2(&m_bTestSuiteStatus, pbyTemp, sizeof(BOOL));

        //File Count
        COPY_DATA_2(&nFileCount, pbyTemp, sizeof(INT));
        INT nFileIndex = 0;
        for(INT i = 0; i < nFileCount; i++)
        {
            UINT unCount, unConfigCount;

            //File Path
            CString omstrFileName;
            DWORD dwID;
            char acName[MAX_PATH] = {_T('\0')};
            COPY_DATA_2(acName, pbyTemp, (sizeof (char) * MAX_PATH));
            omstrFileName = acName;
            if(AddTestSetup(omstrFileName, dwID) == S_OK)
            {
                //Selection Status
                BOOL bStatus;
                COPY_DATA_2(&bStatus, pbyTemp, sizeof(BOOL));
                POSITION pos = m_ouTestSetupEntityList.FindIndex(nFileIndex++);
                if(pos != NULL)
                {
                    CTestSetupEntity& ouTestSetupEntity = m_ouTestSetupEntityList.GetAt(pos);
                    ouTestSetupEntity.vEnableEntity(bStatus);

                    //TestCase Count
                    COPY_DATA_2(&unConfigCount, pbyTemp, sizeof(UINT));
                    ouTestSetupEntity.GetSubEntryCount(unCount);
                    if(unConfigCount != unCount)
                    {
                        //File Has Modified;
                    }

                    //TestCase Selection Status
                    for(UINT j=0; j<unCount; j++)
                    {
                        CBaseEntityTA* pTCEntity;
                        COPY_DATA_2(&bStatus, pbyTemp, sizeof(BOOL));
                        ouTestSetupEntity.GetSubEntityObj(j, &pTCEntity);
                        if(pTCEntity != NULL)
                        {
                            pTCEntity->vEnableEntity(bStatus);
                        }
                    }
                }
            }
            else
            {
                UINT unConfigCount;
                BOOL bStatus;
                COPY_DATA_2(&bStatus, pbyTemp, sizeof(BOOL));
                COPY_DATA_2(&unConfigCount, pbyTemp, sizeof(UINT));
                BOOL* bTempData = new BOOL[unConfigCount];
                COPY_DATA_2(bTempData, pbyTemp, unConfigCount*sizeof(BOOL));
                delete []bTempData;
            }
            //File Path + Selection Status + Number of TestCases + Testcases Status
        }
    }
    return S_OK;
}
예제 #17
0
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;
}
예제 #18
0
/******************************************************************************
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;
}
예제 #19
0
/******************************************************************************
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;
}
예제 #20
0
/******************************************************************************
Function Name  :  TSX_VerifyMessage
Input(s)       :
Output         :  HRESULT
Functionality  :
Member of      :  CTSExecutionCAN
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  01/04/2011
Modifications  :
******************************************************************************/
HRESULT CTSExecutionCAN::TSX_VerifyMessage(CBaseEntityTA* pEntity, CResultVerify& ouVerifyResult)
{
    //TODO::Proper Handling Required
    UCHAR pucData[8];
    INT dataSize = 8;
    STCANDATA sCanData;
    UINT unVerifyCount;
    HRESULT hResult = S_OK;
    CBaseEntityTA* pVerifyEntity;
    CVerify_MessageData ouVerifyData;
    CString omResult;
    IFrame* sMsg;
    CVerifyData ouVerify;


    pEntity->GetSubEntryCount(unVerifyCount);
    ouVerifyResult.m_MessageResultList.RemoveAll();

    pEntity->GetEntityData(VERIFY, &ouVerify);
    ouVerifyResult.m_eResult = ouVerify.m_eAttributeError;
    //Loop For all Messages
    for(UINT j=0; j<unVerifyCount; j++)
    {
        pEntity->GetSubEntityObj(j, &pVerifyEntity);
        pVerifyEntity->GetEntityData(VERIFY_MESSAGE, &ouVerifyData);

        if(m_ouCanBufVFSE.ReadFromBuffer(&sCanData, (__int64)ouVerifyData.m_dwMessageID)==0)
        {
            dataSize = sCanData.m_uDataInfo.m_sCANMsg.m_ucDataLen;
            memcpy(pucData, &sCanData.m_uDataInfo.m_sCANMsg.m_ucData, sCanData.m_uDataInfo.m_sCANMsg.m_ucDataLen);
        }
        else
        {
            dataSize = 8;
            memset(pucData, 0, 8);
        }

        //Interprete The Messages
        SMSGENTRY* sMsgEntry = new SMSGENTRY;
        pEntity->m_ouDataBaseManager.nGetMessageInfo(ouVerifyData.m_omMessageName, &sMsg);
        if ( nullptr == sMsg )
        {
            return S_FALSE;
        }

        std::list<InterpreteSignals> interPretedSignalList;
        sMsg->InterpretSignals( pucData, dataSize, interPretedSignalList, false );
        CString strVerDisplay = _("Verifying Message ")+ouVerifyData.m_omMessageName;
        TSX_DisplayMessage(strVerDisplay);
        //Verify The Signals
        CMessageResult ouMsgResult;
        omResult = _("SUCCESS");
        if( ouVerifyData.m_byChannelNumber == sCanData.m_uDataInfo.m_sCANMsg.m_ucChannel )    // solves issue #711, 4th bullet point
        {
            if ( bVerifyCanMessage( ouVerifyData, interPretedSignalList, ouMsgResult ) == FALSE )
            {

                omResult = _("FAIL");
                hResult = S_FALSE;
            }
        }
        else
        {
            omResult = _("FAIL");
            hResult = S_FALSE;
        }
        ouVerifyResult.m_MessageResultList.AddTail(ouMsgResult);
        TSX_DisplayResult(omResult);
        //delete []pucData;
    }
    if( S_FALSE != hResult )
    {
        ouVerifyResult.m_eResult = SUCCESS;
    }
    return hResult;
}