Forum Discussion
What it sounds like is your process for exporting the file is somehow locking the file. Could you post more of your actual code you're using? Perhaps you're not freeing the file handle appropriately.
- NairatAhmad8 years agoNew Contributor
Thanx for the reply,
The main application closes the file well, I even tried to create that csv file using notepad++ and then use test complete to compare with it, sometimes the file gets locked and sometimes not.
there's no much code, just a line of comparison :
assuming the expected output is named stored_file.
and assuming my target file which is produced by the external app is D:\thing\output_file.txt
I use this line of code as a check point:
Files.stored_file.check("D:\thing\output_file.txt");
shall I do some sort of file.close or something after the check command?
- tristaanogre8 years agoEsteemed Contributor
So, if it's your application that's doing the file export, is there some indicator on screen in your application that indicates that the export is complete? What you've described as your problem certainly sounds like some sort of timing issue to me where the file is still in process when TestComplete attempts the comparison. If there is such an indicator, I'd add some sort of "Wait Property" call or some sort of wait until that indicator has changed state to indicate that the file export is complete and THEN do your file check.
- NairatAhmad8 years agoNew Contributor
Nope,
The lock is not done by my application, it's done by test complete ..the flow is like this :
1. Application runs the process.
2. Application saves to file successfully.
3. Test complete does the comparison succesfully.
4. Application runs the process again.
5. Application tries to save the file.
6. Boom .. file is locked.
Stopping test complete's running won't unlock the file, the only way is to close test complete's process.
the timing issue you mentioned above might help, I'll try to add some Delay() after the check is finished, and before the next file-generation starts.
Thanks a lot Tristaanogre ..
Related Content
- 2 years ago
- 2 years ago
Recent Discussions
- 9 hours ago
- 7 days ago
- 10 days ago