I've been writing some VB scripts to analyze and export test results. I have code that will do all of the processing, given a TestSet object, and I have the code below that gets called with a user clicks a toolbar button in the Test Lab task. What I need is a way to get the currently selected Test Set to pass to the processing subroutine. Does anyone have a suggestion on how to do this?
01. LR 11.1 (Patch 3)
02. Web(HTTP/HTML) URL method
05. LoadRunner 11.1
07. Subscription - 5000 Web and Multimedia
09. Win Vista Enterprise SP2/Ubuntu Linux 10.04 LTS/Solaris
10. I haven't filed one.
You can use the 'TestLab_TestSet_MoveTo' event to record the ID number of the actively selected test set (just store it in a module level variable). When you execute your code, use the ID and the TDConnection object to access the TestSet object itself. Then you can execute your code against the TestSet.
I understand the TDConnection object, and I can get the TestSet from that, if I have the ID of the one I want. Looking at the TestLab_TestSet_MoveTo event, I don't see anything in it that would give me a test set ID. Using the code below, I would expect that CY_CYCLE would be null if a folder was selected. However, CY_FOLDER and CY_CYCLE always have values, so I can't reliably get a testset--by name or ID. Do you have an example?
<font class="small">Code:</font><hr /><pre>
On Error Resume Next
If ActionName = "ExportResults" Then
TestLab_ActionCanExecute = Project_DefaultRes
On Error GoTo 0
Sub ExportResults ()
MsgBox "CY_FOLDER_ID: " & TestSet_Fields.Field("CY_FOLDER_ID").Value
MsgBox "CY_CYCLE_ID: " & TestSet_Fields.Field("CY_CYCLE_ID").Value
MsgBox "CY_CYCLE: " & TestSet_Fields.Field("CY_CYCLE").Value