/****************************************************************************** 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; }
/****************************************************************************** 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; }
/****************************************************************************** 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; }
/****************************************************************************** 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; }
/****************************************************************************** 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; }
/****************************************************************************** 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; }