Qtp,导出数据表到Quality Center

发布于 2024-09-06 05:52:15 字数 1152 浏览 3 评论 0原文

我的 QTP 脚本位于测试脚本选项卡中,数据表位于 QC 测试计划的附件选项卡中。 我将这些数据表导入到 QTP 的数据表(全局)中,并使用 QTP 脚本参数化在我的应用程序中使用数据,然后脚本使用应用程序自动生成的值更新此全局数据表。

现在,问题是当我使用 Export / ExportSheet 功能将全局数据表导出回 QC 附件选项卡中的测试数据表时,我没有发现它们正在更新。

如何实现将全局数据表从 QTP 导出到 Quality Center?

我想将整个数据表另存为新文件或更新附件中已有的数据表。

将其保存在“测试资源”选项卡中也可以。

事实上,任何能够进入 Quality Center 的方式都让我很高兴。

使用 QTP 10.0 和 QC 10.0

详细示例

我有一个测试,将检查客户在网站上购买商品的计算税费。我想保存每行的结果
所以我有看起来像这样的数据表

Customer   Item   Expected_Tax   Actual_Tax  Pass_Fail
normal     apple  25             
normal     pear   10             
manager    apple  12             

当我运行测试时,QTP 填充数据表中的空白

Customer   Item   Expected_Tax   Actual_Tax  Pass_Fail
normal     apple  25             25          pass
normal     pear   10             25          fail              
manager    apple  12             25          fail

现在我想保存这个数据表,但是当测试结束时数据会丢失。所以我想保存它。我知道我可以将其保存在本地计算机上。但我想将其保存在 QC 中,以便我们以后可以检索它。

更新

事实证明,数据表实际上已保存,如果您打开测试实验室并查看测试运行,您可以找到它。但我仍然想知道如何将数据表保存为测试资源或附件

I have my QTP Scripts in Test Scripts Tab and datasheets in the Attachment Tab of TestPlan of QC.
I import these datasheets to Datatable (Global) of QTP and use the data in my application using the QTP Script Parameterization and then Script updates this Global Datatable with auto generated values from application.

Now, the issue is when I export the Global Datatable using Export / ExportSheet function back to the Test Data sheets in attachments tab of QC, I don't find the them being updated.

How can I achieve this export of Global Datatable from QTP to Quality Center?

I would like to either save the entire DataTable as a new file or update the DataTable I have in attachments already.

Saving it in the "Test Resources" tab would also be ok.

Actually, any way I could get in into Quality Center make me happy.

Using QTP 10.0 and QC 10.0

Detailed Example:

I have a test that will check the calculated tax for customers buying stuff at a website. And I want to save the result for each row
So I have data table that looks like this

Customer   Item   Expected_Tax   Actual_Tax  Pass_Fail
normal     apple  25             
normal     pear   10             
manager    apple  12             

As I run my tests QTP fill the blanks in the data table

Customer   Item   Expected_Tax   Actual_Tax  Pass_Fail
normal     apple  25             25          pass
normal     pear   10             25          fail              
manager    apple  12             25          fail

Now I want to save this data table, but when the test ends it the data is lost. So I want to save it. I know I can save it locally on my machine. But I want so save it in QC so we can retrive it later.

Update

Turns out that the data table actually is saved and you can find it if you open Test Lab and look at a test run. But I would still like to know how to save the Data Table as a Test Resource or Attachment

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

只怪假的太真实 2024-09-13 05:52:15

终于找到了这个问题的答案。
可以使用 QC OTA API 将其导出到 QC。

我为此做了一个函数

Function SaveToQC(ResourceName)
    '' Connection To QC
    Set qcc = QCUtil.QCConnection

    '' Setting Temp Folder
    TempFolder = environment("SystemTempDir") 

    Set ResourceFactory = qcc.QCResourceFactory
    Set ResourceList = ResourceFactory.NewList("")
    Set Resource = Nothing
    iTotalItems = ResourceList.Count
    For ItemCtr = 1 To iTotalItems
    CurItem = ResourceList.Item(ItemCtr).Name
    If UCase(CurItem) = UCase(ResourceName) Then
        Set Resource = ResourceList.Item(ItemCtr)
    End If
    Next
    Set ResourceFactory = Nothing
    Set ResourceList = Nothing

    '' Export Datatable to Temp Directory
    Datatable.Export TempFolder & "\" & Resource.Filename

    Resource.Post

    Resource.UploadResource TempFolder, True
End Function

Finally found the answer to this one.
It's possible to use the QC OTA APIs to export it to QC.

I made a function for this

Function SaveToQC(ResourceName)
    '' Connection To QC
    Set qcc = QCUtil.QCConnection

    '' Setting Temp Folder
    TempFolder = environment("SystemTempDir") 

    Set ResourceFactory = qcc.QCResourceFactory
    Set ResourceList = ResourceFactory.NewList("")
    Set Resource = Nothing
    iTotalItems = ResourceList.Count
    For ItemCtr = 1 To iTotalItems
    CurItem = ResourceList.Item(ItemCtr).Name
    If UCase(CurItem) = UCase(ResourceName) Then
        Set Resource = ResourceList.Item(ItemCtr)
    End If
    Next
    Set ResourceFactory = Nothing
    Set ResourceList = Nothing

    '' Export Datatable to Temp Directory
    Datatable.Export TempFolder & "\" & Resource.Filename

    Resource.Post

    Resource.UploadResource TempFolder, True
End Function
好多鱼好多余 2024-09-13 05:52:15

它是 QC 中测试资源中资源的名称。因此,如果QC中的资源位于root\Test Automation\Datatable,其中上传了Datatable.xls,则需要将“Datatable”作为ResourceName传递。我在测试中使用过它,效果非常好。谢谢!

It's the name of the Resource in the testresources in QC. So if the resource in QC is located at root\Test Automation\Datatable, which has Datatable.xls uploaded in it, you need to pass "Datatable" as ResourceName. I've used it in my test and this works great. Thanks!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文