IBM Support

How to retrieve the data in an Object Data Verification Point at runtime.

Troubleshooting


Problem

To capture data at runtime that is accessible via an Object Data verification point, but that cannot be captured with the SQAGetProperty or the Clipboard.GetText() commands.

Cause

The SQAGetProperty command cannot retrieve data is not contained in an object's property, and Clipboard.GetText() cannot retrieve the data that cannot first be copied to the Clipboard.

Resolving The Problem

At the bottom of this note is a sample function, GetData, that retrieves the data captured by an object data verification point and then puts that data into an array.

For the function to work,

  • Create an object data verification point
  • Make sure the script plays back to a log when it is played back (Select Tools > GUI Playback Options from IBM Rational Robot's menu and then click the Logging tab)
  • Make sure that the Skip Verification Points option is NOT checked (Select Tools > GUI Playback Options from Robot's menu and then click the Playback tab)

To understand how the GetData function works, it is helpful to understand how what happens when a Robot GUI script with an object data verification point is played back. The object data verification point in script is the baseline verification point. When the script is played back to a log, Robot copies the baseline to the log folder; the copy is called the expected verification point (hence the .exp extension of the expected verification point file). If the verification point fails, Robot creates another file that contains the actual data that was captured on playback (this file has an .act extension).

The GetData function accesses the expected verification point file if the verification point passed, or the actual verification point file if the verification point failed. The GetData function will return a 0 if the function succeeded in opening one of these files. If the script is not played back to a log, or if something else goes wrong, the function returns -1.

The GetData function takes three arguments: the name of the script with the object data verification point, the name of the object data verification point and the name of the single dimensional array that will contain the data from the verification point. Typically, the first and last lines of the verification point file are blank, so the first and last elements in the array will also be blank.


WARNING: THIS FUNCTION IS NOT MEANT TO BE USED IN A LOOP.


Function GetData(ScriptName As String,VPName As String, Data() As String) As Integer

Dim vpPath As String
Dim fname As String
Dim x As Integer

vpPath = SQAGetLogDir
Dim aline As String
x = 1

Redim data(10)
fname = Dir(vpPath & "vp\" & ScriptName & "." & VPName & ".act*.grd")
If fname = "" Then fname = Dir(vpPath & "vp\" & ScriptName & "." & VPName & ".exp.grd")
If fname = "" Then
GetData = -1
Exit function
End if

Open vpPath & "vp\" & fname For Input As #1
Line Input #1, aline

Do While Not EOF(1)
If Ubound(data) = x Then Redim Preserve data(x + 10)
Data(x) = aline
Line Input #1, aline
x = x + 1
Loop

Redim Preserve data(x)

Close #1
GetData = 0

End function

A sample script that uses this function is also attached (MyExampleScript). The script runs against the Visual Basic Try It! sample application that ships with IBM Rational Robot.





MyExampleScript.rec

[{"Product":{"code":"SSSHDX","label":"Rational Robot"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Scripting","Platform":[{"code":"PF033","label":"Windows"}],"Version":"2001a;2001a.04.00;2002;2002.05.00;2002 Release 2;2002.05.20;2003;2003.06.00;2003.06.12;2003.06.13;2003.06.14","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Historical Number

12192

Document Information

Modified date:
16 June 2018

UID

swg21134151