1

I am trying to read a config file in my VAPI test case in QC. Following is the code snippet:

Set objFSO =CreateObject("Scripting.FileSystemObject")
Set objFile=objFSO.OpenTextFile(strFileName,1)
strText = objFile.ReadAll
objFile.Close

However I am getting the following error: Operation is not allowed when the object is closed.

I am able to use the same code if run it from outside of QC in simple .vbs file.Can anyone please help me out with this. Thanks

  • Maybe a variable name collision? Try another name for `objFile` (add appropriate prefix or suffix) or make it's scope local explicitly using `Private` statement. Supposedly the same for `objFSO`... – JosefZ Apr 27 '15 at 22:23
  • Hi, I already tried both of these suggestions..not working...I have just declared these variables once in the VAPI test. Do you think this can be any QC specific issue ? – user2584656 Apr 28 '15 at 04:04

0 Answers0