TestSet中的OTA API运行测试

时间:2015-10-09 14:46:29

标签: api vbscript ota alm qc

我们登录应用程序并在应用程序中执行所有测试。如果测试失败,那么我们清除envoirement(关闭浏览器和进程)并再次登录,但仅在测试失败时。

要获得此行为,我需要运行test by Test,以便暂停全局执行以执行登录,然后继续测试。

问题是当我在“TestList”中进行迭代时,每次运行(Scheduler.Run(Test))都在执行孔TestSet而不是TestSet中的一个测试。

所以我们编写了以下代码:

Set TSetFact = ALMConnection.TestSetFactory
Set tsTreeMgr = ALMConnection.TestSetTreeManager

Set TestFolderNode = tsTreeMgr.NodeByPath(FolderPath)
Set SubFolderNode = TestFolderNode.NewList
Set TestSetNode = TestFolderNode.TestSetFactory
Set TestSetList = TestSetNode.NewList("")

For Each TestSet In TestSetList 

    Set TestFactory=TestSet.tsTestFactory
    Set TestList = TestFactory.NewList("")
    For Each Test In TestList

        Set Scheduler = TestSet.StartExecution("")
        Scheduler.RunAllLocally = True
        Scheduler.Run(Test)
        Set execStatus = Scheduler.ExecutionStatus

        Do While RunFinished = False
            execStatus.RefreshExecStatusInfo "all", True
            RunFinished = execStatus.Finished
            Set EventsList = execStatus.EventsList

            For Each ExecEventInfoObj in EventsList
                strNowEvent = ExecEventInfoObj.EventType
                If strNowEvent=1 Then
                    flagFail=1
                    KillProcess ("UFTRemoteAgent.exe")
                    Login(FolderPath)
                    Exit For
                End If
            Next

            If flagFail=1 Then
            RunFinished = True
            flagFail=0
            End If
        Loop

        KillProcess ("UFTRemoteAgent.exe")
        Set Scheduler = Nothing
        Set execStatus=Nothing
        Set EventsList=Nothing
        Set ExecEventInfoObj=Nothing
        Set strNowEvent=Nothing
        RunFinished = False
    Next
    Set TestFactory=Nothing
    Set TestList=Nothing
Next

已解决:http://h30499.www3.hp.com/t5/Quality-Center-Support-and-News/OTA-API-Running-TestSet-one-test-at-the-time/td-p/6800861

0 个答案:

没有答案