Forum Discussion
5 Replies
- vatbubContributor
Hey khush,
great to see you here in the forum!
What do you want to do with those files? Just check if they are present or open them to see their contents?
If you just want to check if the files are present on the disk, you can do it as follows:
Create a Script Test and paste the following code in it:
aqObject.CompareProperty(aqFileSystem.Exists(C:\Path\To\Your\Report.pdf), cmpEqual, true);
If you wish to check the file contents, you may find the File Checkpoint operation useful.
Either way, you need to find some way to identify the file you need. Here are some ideas to do so:
- Ask your developers if there is some logic behind the filenames
- Delete all files in the report folder at the beginning of the test using the DeleteFile-Method and a for-loop or the DeleteFolder-method. In that case, there should be only the current report in that folder.
Greetings,
vatbub
- khushbupatelOccasional Contributor
Thanks for your detailed reply. I want to read the content of PDFs and compare them with baseline files but I do not want to use File Checkpoints. I have figured out that part but only need to figure out reading random name of PDFs. I was thinking about it and so far what I have done is when developers generate report, they automatically open them so I will Save as file and give it a name I want and then read them.
I will see how it goes along the road.
Again thank you !
- vatbubContributor
Hi khus,
what about deleting all files from the directory prior to starting the test? Then, you should only find your newly generated report in that directory.
Greetings,
vat