UPDATE! The community will be go into read-only on April 19, 8am Pacific in preparation for migration on April 21. Read more.
UPDATE! The community will be go into read-only on April 19, 8am Pacific in preparation for migration on April 21.Read more.
Absent Member.. Absent Member..
Absent Member..

VAPI-XP Always throws error about object required, cannot find out where issue is

Below is the code, I think I am going stir crazy from looking at it but I cannot find out where I have not defined an object.


Input welcome.  Thanks in advance.


' VAPI Test BSP [VBScript]
' Created by Quality Center
' 6/3/2013 4:52:05 PM
' ====================================================

' ----------------------------------------------------
' Main Test Function
' Debug - Boolean. Equals to false if running in [Test Mode] : reporting to Quality Center
' CurrentTestSet - [OTA COM Library].TestSet.
' CurrentTSTest - [OTA COM Library].TSTest.
' CurrentRun - [OTA COM Library].Run.
' ----------------------------------------------------
Sub Test_Main(Debug, CurrentTestSet, CurrentTSTest, CurrentRun)
Dim rShell
Dim CommandString
Dim resourceName
Dim saveTo
Dim oResource
Dim oFilter
Dim oFile
  ' *** VBScript Limitation ! ***
  ' "On Error Resume Next" statement suppresses run-time script errors.
  ' To handle run-time error in a right way, you need to put "If Err.Number <> 0 Then"
  ' after each line of code that can cause such a run-time error.
  On Error Resume Next

  ' clear output window
  resourceName = "Training_Task_1.vbs"
  saveTo = "C:\Sample"
  Set oResource = QCResourceFactory
  Set oFilter = oResource.Filter
  Set oFilter.Filter("RSC_FILE_NAME") = resourceName
  Set oResourceList = oFilter.NewList

  If oResourceList.Count = 1 Then
     Set oFile = oResourceList.Item(1)
     Set oFile.FileName = resourceName
     oFile.DownloadResource saveTo, True
  end if

  Set rShell = CreateObject("WScript.Shell")
  CommandString = "WScript.exe " & saveTo & "\" & resourceName
  rShell.Run CommandString, 1, True

  If Not Debug Then
  End If
  ' handle run-time errors
  If Err.Number <> 0 Then
    TDOutput.Print "Run-time error [" & Err.Number & "] : " & Err.Description
    ' update execution status in "Test" mode
    If Not Debug Then
      CurrentRun.Status = "Failed"
      CurrentTSTest.Status = "Failed"
    End If
  End If
End Sub

0 Replies
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.