首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从REST执行QTP TestSet

从REST执行QTP TestSet
EN

Stack Overflow用户
提问于 2013-05-03 03:10:25
回答 3查看 1K关注 0票数 4

有没有人有一个可以启动测试集的xml代码块(curl示例会很棒)?

HP-ALM中的REST文档没有展示如何从REST执行测试集。有一个关于如何创建缺陷的描述。第二个问题是,文档建议必填字段包括cycle_id和testcycl_id,我找不到方法来获取它们的值。

具体地说,我想通过POST创建一个Run对象

谢谢

EN

回答 3

Stack Overflow用户

发布于 2014-02-11 21:10:27

ALM REST API没有启动自动化测试的功能。为了同样的目的,我们需要使用OTA API。

票数 0
EN

Stack Overflow用户

发布于 2017-05-23 21:32:58

通过OTA在VBS中尝试此代码。

代码语言:javascript
复制
    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
EN

Stack Overflow用户

发布于 2017-09-27 18:52:11

通过Rest Api,您可以为测试集中的每个测试实例创建run,并在执行时通过特定测试用例的run-steps更新每个步骤。创建运行时,您需要更新以下必填字段:-

代码语言:javascript
复制
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>

创建run之后,您需要从生成的响应Xml /qcbin/rest/domains/{domain}/projects/{project}/runs/?query={name[Run_2015-04-15]}-use中获取Run-ID{Run ID}此url以获取{Run ID}将用于更新以下Url中的steps.Used

代码语言:javascript
复制
/qcbin/rest/domains/{domain}/projects/{project}/runs/{Run ID}/

对于运行步骤:-获取查询url后面的特定步骤(如步骤1、2...).Use的ID。

代码语言:javascript
复制
/qcbin/rest/domains/{domain}/projects/{project}/runs/{Run ID}/run-steps/?query={name[Step 1]}-use this url to get Step ID {ID}.

要更新步骤:- 1.使用以下url:-

代码语言:javascript
复制
 /qcbin/rest/domains/{domain}/projects/{project}/runs/{Run ID}/run-steps/{ID}

2.生成Xml并使用post方法更新状态字段。

代码语言:javascript
复制
 <?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>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16345908

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档