Пример #1
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;
}
Пример #2
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;
}
Пример #3
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;
}
Пример #4
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;
}