chitti_1990 Absent Member.
Absent Member.
1267 views

How to get the actual results, Comments from the executed test cases into an excel sheet using VBA

Hi ,

 

I need actual results, Comments from the executed test cases into an excel sheet using VBA.

 

Could you pls help

0 Likes
7 Replies
Absent Member.. Trudy Claspill Absent Member..
Absent Member..

Re: How to get the actual results, Comments from the executed test cases into an excel sheet using V

You need to either execute database queries or use the available APIs (OTA or REST), if you want to imbed the retrieval in an Excel workbook.

Why not just use one of the report options available in the Dashboard module?
[If this post solves or helps solve your issue, mark the thread as solved and give KUDOS to the author for their assistance.]

(Opinions expressed in my postings are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any solution/suggestion posted.)
0 Likes
chitti_1990 Absent Member.
Absent Member.

Re: How to get the actual results, Comments from the executed test cases into an excel sheet using V

I got the code to get the expected results, description, step name from HP QC.But I want Actual results and comments also included. Can you help  me having the code that gets Actual results and comments too.

 

I used QC APIs to get the data

0 Likes
Absent Member.. Trudy Claspill Absent Member..
Absent Member..

Re: How to get the actual results, Comments from the executed test cases into an excel sheet using V

Show us the code you have and we might be able to suggest what you need.

[If this post solves or helps solve your issue, mark the thread as solved and give KUDOS to the author for their assistance.]

(Opinions expressed in my postings are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any solution/suggestion posted.)
0 Likes
chitti_1990 Absent Member.
Absent Member.

Re: How to get the actual results, Comments from the executed test cases into an excel sheet using V

Removed the code of mine as it is not useful

Tags (1)
0 Likes
Established Member.. William Schmitt
Established Member..

Re: How to get the actual results, Comments from the executed test cases into an excel sheet using V

The DesignSteps will give you the expected results.  If you want the actual results, you need to get the StepFactory of the Run object for the test execution.  There you will get the Step object, which has Status.

0 Likes
chitti_1990 Absent Member.
Absent Member.

Re: How to get the actual results, Comments from the executed test cases into an excel sheet using V

Could you pls let me know how to write code for that?





 

0 Likes
Highlighted
Established Member.. William Schmitt
Established Member..

Re: How to get the actual results, Comments from the executed test cases into an excel sheet using V

Sub Get_Results()
    Dim td As New TDConnection
        
    td.InitConnectionEx "__________"
    td.ConnectProjectEx "______", "_____________", "____", "_________"
    
    Dim tset As TestSet
    Dim tstestfact As TSTestFactory
    Dim tstest As tstest
    Dim tlist As List
    Dim mytest As Test
    Dim myStepFact As StepFactory
    Dim mystep As DesignStep
    Dim runfact As RunFactory
    Dim runlist As List
        
    Dim rowcount As Long
    
    Dim rng As Range
    Set rng = Worksheets("Sheet1").Range("A1:A1")
    
    Set tsfact = td.TestSetFactory
    
    Dim TestSetID As Long
    TestSetID = xxxxxxx
    Set tset = tsfact.Item(TestSetID)
    Set tstestfact = tset.TSTestFactory
    Set tlist = tstestfact.NewList("")
    
    rowcount = 0
    For Each tstest In tlist
        Set runfact = tstest.RunFactory
        Set runlist = runfact.NewList("")
        
        For Each myrun In runlist
            Set myStepFact = myrun.StepFactory
            Set StepList = myStepFact.NewList("")
            
            For Each mystep In StepList
                rng.Offset(rowcount, 0) = myrun.TestSource
                rng.Offset(rowcount, 1) = mystep.StepName
                rng.Offset(rowcount, 2) = mystep.Field("ST_STATUS")
                rng.Offset(rowcount, 3) = mystep.Field("ST_DESCRIPTION")
                rng.Offset(rowcount, 4) = mystep.Field("ST_EXPECTED")
                rng.Offset(rowcount, 5) = mystep.Field("ST_ACTUAL")
                
                rowcount = rowcount + 1
            Next
            rowcount = rowcount + 1
        Next
        rowcount = rowcount + 1
    Next
 
    
    td.Logout
    td.Disconnect
    td.ReleaseConnection
    Set td = Nothing
    
End Sub

You almost have it.  Just replace DesignStepFactory with StepFactory, but to get to that you need the TSTest and Run objects.  This code has not been tested and is probably not complete.  In Excel, I like to use range offsets to output multiple rows.  It's a lot cleaner code.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.