Forum Discussion
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
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 !
- vatbub9 years agoContributor
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
- khushbupatel9 years agoOccasional Contributor
Yes that should work but they do not want me to delete files after they are generated for the final build execution during the project, they want to keep them for records or in case for troubleshooting.
Khushbu
- Colin_McCrae9 years agoCommunity Hero
You can get all the files in a directory and then check their creation date?
Assuming you'll be wanting the most recently created version ...