1

我正在尝试使用 OTA 和 HP ALM 11.52 在“分析视图”中创建报告。我搜索了 OTA 参考文档并在线查找示例,我找到了一些示例,但似乎没有一个有效。

似乎使用了三种方法:

TDConnection.GraphBuilder.BuildGraph(GraphDefinition)

TDConnection.testFactory.BuildSummaryGraph("TS_STATUS", "TS_STATUS", "", 0, myFilter, False, False)

and a third method involving an AnalysisItemFactory object that I can't find anywhere in the OTA documentation.

我已经尝试了前两个,它们似乎在没有触发错误的情况下运行,但是 ALM 中没有出现图表。

这些方法之间有区别吗?哪种方法最干净?

到目前为止,这是我的尝试:

        '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        'Method 1: GraphBuilder

        'Set GB = QCConnection.GraphBuilder

        'Set G1 = GB.CreateGraphDefinition(2, 0)
        'G1.Property(0) = "TS_NAME"
        'G1.Property(1) = "TC_STATUS"
        'Set tsf = QCConnection.TestSetFactory
        'Set myFilter = tsf.Filter
        'myFilter.Filter ("TC_STATUS") = "Not(N/A)"
        'G1.Filter = "Filter: Status[Not N/A]"
        'Set g = GB.BuildGraph(G1)

        '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        'Method 2: BuildSummaryGraph            

        'Dim testF
        'Dim graph1
        'Dim Filter

        'Set testF = QCConnection.testFactory

        'Set myFilter = testF.Filter
        'myFilter.Filter("TS_STATUS") = "Not(N/A)"

        'Set graph1 = _
        'testF.BuildSummaryGraph("TC_NAME", "TS_STATUS", "", 0, myFilter, False, False)

        '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        'Method 3: AnalysisItemsFactory? I can't find any documentation on this object, yet I've seen it referenced in other code samples.

        'Set aiFolderFact = QCConnection.AnalysisItemFolderFactory
        'Set aiFact = QCConnection.AnalysisItemFactory ~~~ This line actually runs fine so I know it at least exists. But I am definitely not using the proper methods below.

        'Set G1 = aiFact.AddItem("")
        'G1.Field("AI_PARENT_ID") = 1001 'Public
        'G1.Field("AI_TYPE") = "Graph"
        'G1.Field("AI_SUB_TYPE") = "Progress Graph"
        'G1.Field("AI_OWNER") = qcUserName.Value
        'G1.Field("AI_MODULE") = "requirement"
        'G1.Field("AI_NAME") = "test graph"

        'G1.Post

正如我之前提到的,所有这些脚本都可以正常运行,但我在分析视图中看不到图表。我还注意到似乎没有“名称”或“路径”字段。

我查看了这些表,似乎有“Analysis_Item_Folder”和“Analysis Items”表,所以知道可以通过 OTA 客户端执行此操作。是否有 AnalysisItemFactory,有人可以提供我正在寻找的示例脚本吗?

4

2 回答 2

1

我能够在此 HP ALM 论坛条目的帮助下生成报告。正如论坛中提到的,它不是 HP ALM 的官方文档功能。因此,将来它可能无法在没有更换的情况下工作。请记住这一点。

万一论坛条目可能被删除,我在这里复制了一个名为“ delarosa62 ”的用户的答案(复制日期2015/9/8):

嗨 MichaelMotes 和其他社区成员。

我开发了一个 VBA 代码来自动生成仪表板标准报告。我得到了你提到的“成功的例外”。但是我的报告没有在我的硬盘中生成。

我没有收到任何错误。 我已使用 OTA 将您的 Visial Basic 代码改编为 VBA。我在 VBA 模块窗口的工具/参考选项中注册了 otareport 1.0 类型库和 otaxml 类型库。

我在下面粘贴我的代码,希望你们能给我一些见解。我没有收到任何错误。只是包含成功完成消息的异常。

Sub externalSTDReports()

    Dim reqFact  
    Dim reqFilter  
    Dim reqList      
    Dim gTDConn As Object  

    Set gTDConn = CreateObject("TDApiOle80.TDConnection")

    'QC Connection data    

    login_id = ActiveWorkbook.Sheets("CONFIG").Cells(9, 3).value  
    login_passwd = ActiveWorkbook.Sheets("CONFIG").Cells(10, 3).value  
    domain_name = ActiveWorkbook.Sheets("CONFIG").Cells(11, 3).value  
    project_name = ActiveWorkbook.Sheets("CONFIG").Cells(12, 3).value  
    server_name = ActiveWorkbook.Sheets("CONFIG").Cells(13, 3).value            

    gTDConn.InitConnectionEx server_name      
    gTDConn.login login_id, login_passwd      
    gTDConn.Connect domain_name, project_name

    Set Rep = New OTAREPORTLib.Reporter            
    Call Rep.SetConnection(gTDConn, 0)     ' This line  doesn´t return errors. But I don´t know if it is correct                      
    Set RepConf = Rep.ReportConfig                        
    Rep.File = "C:\Users\cris\AppData\Local\Temp\TD_80\4c223b57\Reports\std.html"            
    Rep.Template = "C:\Users\cris\AppData\Local\Temp\TD_80\4c223b57\Reports\default.xsl"
    '******************************************************** filter Reports    

    Set aiFact = gTDConn.AnalysisItemFolderFactory  
    Set reportFact = gTDConn.AnalysisItemFactory
    Set aiFilter = aiFact.Filter  
    Set aiList = aiFilter.NewList  
    Set anf = reportFact.Filter  

    Dim FilterStr As String       

    For Each ai In anf.NewList            
        reportName = ai.Name       
        reportID = ai.id           

        If reportName = "tmp" Then                 
            FilterStr = ai.Field("AI_FILTER_DATA")             
            RepConf.Filter = FilterStr                

            On Error Resume Next 
            'i is empty. Don´t know why

            i = Rep.Generate(0, 0)                 MsgBox i & " --- " & Rep.File                         Debug.Print Rep.File      '--------------------         Exit For      
        End If
    Next

    Set gTDConn = Nothing   
    Set aiFact = Nothing   
    Set reportFact = Nothing
    Set aiFilter = Nothing     
    Set aiList = Nothing    Set anf = Nothing
    Set RepConfig = Nothing
    Set Rep = Nothing          

    MsgBox "END "
End Sub    'Pls HELP!!
于 2015-09-08T14:37:10.260 回答
0

Graphs can be generated under analysis folder, its a bit of a process because you need a sound understanding of the database, XML and OTA API. There is no direct API available for building graphs, I have created the code samples below

https://github.com/sumeet-kushwah/ALM_OTA_Wrapper/blob/master/ALM_Wrapper/Analysis.cs

Check the following functions

CreateDefectAgeGraph

CreateExcelReport

CreateDefectSummaryGraph

CreateSummaryGraph

These functions are called from the tests available below

https://github.com/sumeet-kushwah/ALM_OTA_Wrapper/blob/master/ALM_Wrapper_Tests/ALM_Wrapper_Test.cs

Look for test function

Test_AnalysisAndDashboardScripts

If you have any questions regarding the process, please let me know.

于 2019-03-18T18:27:20.417 回答