Another way of exporting run results is via TestPartner.TLB automation. The beauty with TestPartner.TLB is that you can export with it the xsl.
See below for the code.
Option Explicit
Sub TestTPResultDump()
Dim t As New TPApp
Dim pCount As Integer
Dim p As Integer
Dim sCount As Integer
Dim sName As String
Dim tp2 As TestPartner.TPProject2
t.Login "admin", "admin", "TestPartner_SQL", 1
pCount = t.Projects.Count
For p = 1 To pCount
If t.Projects.Item(p).Name = "ScratchProject" Then
Debug.Print t.Projects.Item(p).Name
Set tp2 = t.Projects.Item(p)
Dim rc As Integer
For rc = 1 To tp2.Results.Count
If tp2.Results.Item(rc).Name = "scratch2" Then
Debug.Print tp2.Results.Item(rc).Description
Debug.Print tp2.Results.Item(rc).Name
Debug.Print tp2.Results.Item(rc).LastModifiedBy
Dim v As Long
v = tp2.Results.Item(rc).CurrentVersion
Dim rr As TestPartner.TPResult
Set rr = tp2.Results.Item(rc)
rr.Open (v)
Debug.Print rr.GetXML(v, v, "d:\test.xml")
Call rr.GetXML(v, 1, "D:\test.xml", "D:\test.xsl")
Dim sXLST As String
Dim fXLST As Scripting.File
Debug.Print rr.GetXSLT(1, sXLST)
'Debug.Print sXLST
Dim fso As Scripting.FileSystemObject
Dim ts As Scripting.TextStream
Set fso = New Scripting.FileSystemObject
Set ts = fso.OpenTextFile("D:\test.xsl", ForWriting, True, TristateTrue)
ts.Write sXLST
ts.Close
Set ts = Nothing
Set fso = Nothing
End If
Next rc
'tp2.Results.Count
End If
Next p
End Sub
Note that you need reference to TestPartner(TestPartner.TLB) and Microsoft Scripting Runtime for the above code snippets to work.
See below for the location of the type library:
~ts
