2014-10-20 58 views
2

到目前爲止,我所看到的是不同的方式,以現有的圖像保存爲一個連接到Quality Center(QC)。這很好,但是有沒有辦法將圖像直接保存爲Quality Center的附件?QTP/UFT Capturebitmap直接保存到Quality Center(QC)

因此,舉例來說,我在自動化框架設定特定區域使用類似捕捉圖像:

瀏覽器(「標題:= ‘)。第(’稱號:=」) .CaptureBitmap [全名,覆蓋]

這將需要得到質量中心的文件夾的路徑,但我不知道怎麼了,這可能嗎?我想將其保存在Quality Center的「測試計劃」部分的文件夾下。

回答

1

好吧我知道了!您可以將其保存到每臺機器上存在的臨時文件夾中。然後保存到QC!

Dim oWsh, strTempFolderPath, strFilePathToSave, QCConnection, treeManager 
    Dim LocalFilePath, Screen1, node, att, atta  

    Set oWsh = CreateObject("WScript.Shell") 
    strTempFolderPath = oWsh.ExpandEnvironmentStrings("%Temp%") 
    strFilePathToSave = strTempFolderPath & "\Test1.png" 

    browser("title:=.*").page("title:=.*").CaptureBitmap strFilePathToSave,True 

    Set QCConnection = QCUtil.QCConnection 
    Set treeManager = QCConnection.TreeManager 
    ' Specify the local path to the file. 

    LocalFilePath = strFilePathToSave 

    ' Specify the Quality Center path to the desired folder 
    Screen1 ="Subject\Path to the folder where you want to save it\" 
    Set node = treeManager.nodebypath(Screen1) 
    set att = node.attachments 
    Set atta = att.AddItem(Null) 
    atta.FileName = LocalFilePath 
    atta.Type = 1 
    atta.Post() 

    Set oWsh = nothing : set QCConnection = nothing : Set treeManager = nothing 
    Set node = nothing : set att = nothing : set atta = nothing 
+0

我的UFT掛在「類型」分配上。任何線索? – thepanuto 2016-02-18 18:43:11

1

測試運行時,結果存儲在本地臨時目錄中。運行結束時,運行結果上傳到QC(如果啓動結果查看器查看QC的運行結果,將會重新下載)。

如果你把你的屏幕截圖該目錄(也許在一個單獨的「屏幕截圖」目錄)下,您的畫面將被保存在QC運行結果的一部分,因此將是可見的,就像其他的運行結果條目。

您可以獲取本地temp目錄:

Environment.Value ("ResultDir") & "\Report\"。該目錄下存放

一切都被認爲是運行結果的一部分,將被上傳到(並取得可用)QC。

相關問題