Find a specific file when the folder get created during run time.
Please need help, I am testing this web application that creates a dynamic folder every time an image is displayed within the software, Here are my test steps.
1) select the customer.
2) select the image to display in the IMAGE view screen.
(note: I can get the image number (i.e 001) within this window)
3) The software creates a folder (i.e 001) using the number assigned for that image in the following path C:\Storage\cache\. (example: C:\Storage\cache\001)
4) Within the cache folder, it will create a file called "imagesnap.jpg"
3) My test result is to make sure the "imagesnap.jpg file exists in the dynamic folder that got created when the image got displayed within the software being tested.
4) The imagesnap.jpg file must exist in every cache folder that is created when an image is displayed in the window.
Before I was using the script below to find the file but now I need to check the cache folder gets created on run time and the file imagesnap.jpg exist in the created cache folder.
Can the script be modified to do this?
- If someone can give an example of how to store the image name (i.e 001) taken from the window display screen and use it in the script.
- Then, compare the stored image name (i.e 001) to the cache folder (i.e ...\001) created in the C:\Storage folder.
- Next, verify the imagesnap.jpg file exist in the cache folder for that image name (i.e C:\Storage folder\001\imagesnap.jpg) and log message "File imagesnap.jpg file exist in cache folder " 001 "
- if not, get a log message "File does not exist". Help is really appreciated.
var foundFiles, aFile;
foundFiles = aqFileSystem.FindFiles("C:\\Storage\\", "imagesnap.jpg");
if (foundFiles != null)
aFile = foundFiles.Next();
Log.Message("No JPG files were found.");
Solved! Go to Solution.
> The folder name will be different on every run so the pathname cannot be hardcoded.
Make it dynamic. Something like this:
var MyFolderName = "C:\\Storage\\octCache\\" + NoMoreJPG + "\\";
var FileFullPath = MyFolderName + "imagesnap.jpg";
/Alex [Community Champion]
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.