2013-05-02 73 views
4

有沒有人有一個可以啓動測試集的xml塊(捲曲示例會很棒)?從REST執行QTP TestSet

HP-ALM中的REST文檔未顯示如何從REST執行測試集。有如何創建缺陷的說明。第二個問題是,文檔建議必需的字段包括cycle_id和testcycl_id,我無法找到獲取其值的方法。

具體來說 - 我想通過POST

創建一個運行物體

感謝

回答

0

ALM REST API不具備的功能開球自動化測試。我們需要與OTA API一樣。

0

由OTA在VBS中嘗試此代碼。

Set tdc = CreateObject("TDAPIOLE80.TDConnection") 

    tdc.InitConnectionEx "https://URLALM" 
    tdc.login "USer", "pass" 
    tdc.Connect "DOMAIN", "PROJECT" 

    Set objShell = CreateObject("WScript.Shell") 
    'Set TSetFact = tdc.TestSetFactory 
    Set tsTreeMgr = tdc.TestSetTreeManager 
    Set tsFolder = tsTreeMgr.NodeByPath("your tree") 
    Set tsList = tsFolder.FindTestSets("testSet") 
    Set theTestSet = tsList.Item(1) 'list of testSets 

    Set Scheduler = theTestSet.StartExecution("") 

    if err.number <> 0 then 
     'msgbox err.Description 
    Else 
     Scheduler.RunAllLocally = True 
     Scheduler.Run 

     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 
      Next 
      For i = 1 To execstatus.Count 
       Set TestExecStatusobj = execstatus.Item(i) 
       intTestid = TestExecStatusobj.TestInstance 
      Next 
     Loop 

     execstatus.RefreshExecStatusInfo "all", True 
    End if 

    Set tsTreeMgr = nothing 
    Set tsFolder = nothing 
    Set tsList = nothing 
    Set theTestSet =nothing 

    tdc.Disconnect 
    tdc.Logout 

    tdc.ReleaseConnection 
    Set tdc = Nothing 
+0

謝謝你,在我的測試VB對象僅適用於桌面操作系統或 bbyrd 2017-09-29 01:09:18

0

通過REST API,您可以在測試組爲每個測試實例的運行,並通過特定的測試用例,而執行的運行步驟更新每個步驟。 在創建你有更新的運行以下必填字段: -

http://<server>/qcbin//rest/domains/<>/projects/<>/runs/ 

<Entity Type=\"run\"><Fields> 
<Field Name=\"name\"><Value>Run_2015-04-15</Value></Field> 
<Field Name=\"testcycl-id\"><Value>573269</Value></Field> 
<Field Name=\"cycle-id\"><Value>4363</Value></Field> 
<Field Name=\"test-id\"><Value>29201</Value></Field> 
<Field Name=\"subtype-id\"><Value>hp.qc.run.MANUAL</Value></Field> 
<Field Name=\"owner\"><Value>owner</Value></Field> 
</Fields></Entity> 

創建運行後,你需要從生成的響應XML /qcbin/rest/domains/{domain}/projects/{project}/runs/?query={name[Run_2015-04-15]}獲取運行ID {潤ID} - 使用此網址獲得{運行ID} 將用於以下網址

/qcbin/rest/domains/{domain}/projects/{project}/runs/{Run ID}/ 

對於運行步驟更新steps.Used: - 。 要獲取特定的步驟(如步驟1,2 ......)的ID使用下面的查詢網址。

/qcbin/rest/domains/{domain}/projects/{project}/runs/{Run ID}/run-steps/?query={name[Step 1]}-use this url to get Step ID {ID}. 

要更新步驟: - 1.使用以下網址: -

/qcbin/rest/domains/{domain}/projects/{project}/runs/{Run ID}/run-steps/{ID} 

2.Generate Xml和使用POST方法來更新狀態字段。

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
- <Entity Type="run-step"> 
+ <ChildrenCount> 
    <Value>0</Value> 
    </ChildrenCount> 
- <Fields> 
+ <Field Name="test-id"> 
    <Value>6</Value> 
    </Field> 
+ <Field Name="comp-status"> 
    <Value /> 
    </Field> 
    <Field Name="rel-obj-id" /> 
    <Field Name="obj-id" /> 
+ <Field Name="has-linkage"> 
    <Value>N</Value> 
    </Field> 
+ <Field Name="execution-date"> 
    <Value>2017-09-25</Value> 
    </Field> 
+ <Field Name="path"> 
    <Value /> 
    </Field> 
+ <Field Name="desstep-id"> 
    <Value>1031</Value> 
    </Field> 
+ <Field Name="attachment"> 
    <Value>Y</Value> 
    </Field> 
+ <Field Name="has-picture"> 
    <Value>N</Value> 
    </Field> 
    <Field Name="tree-parent-id" /> 
+ <Field Name="id"> 
    <Value>24820</Value> 
    </Field> 
+ <Field Name="component-data"> 
    <Value /> 
    </Field> 
+ <Field Name="bpt-path"> 
    <Value /> 
    </Field> 
+ <Field Name="actual"> 
    <Value><html><body> Results match expected </body></html></Value> 
    </Field> 
+ <Field Name="step-order"> 
    <Value>1</Value> 
    </Field> 
    <Field Name="level" /> 
+ <Field Name="expected"> 
    <Value><html><body> <div align="left"> <font face="Arial"><span style="font-size:8pt">Successful launch of website</span></font> </div> </body></html></Value> 
    </Field> 
    <Field Name="line-no" /> 
+ <Field Name="comp-subtype-name"> 
    <Value /> 
    </Field> 
- <Field Name="extended-reference"> 
    <Value /> 
    </Field> 
- <Field Name="name"> 
    <Value>Step 1</Value> 
    </Field> 
+ <Field Name="execution-time"> 
    <Value>03:56:29</Value> 
    </Field> 
+ <Field Name="bpta-condition"> 
    <Value /> 
    </Field> 
+ <Field Name="user-template-01"> 
    <Value>Website Tester</Value> 
    </Field> 
+ <Field Name="parent-id"> 
    <Value>1522</Value> 
    </Field> 
+ <Field Name="user-template-03"> 
    <Value /> 
    </Field> 
+ <Field Name="bpt-facet-type"> 
    <Value /> 
    </Field> 
+ <Field Name="user-template-04"> 
    <Value>kama</Value> 
    </Field> 
- <Field Name="status"> 
    <Value>Passed</Value> 
    </Field> 
    </Fields>