Ask a Question

Getting the time a file is created

SOLVED
Ned
Occasional Contributor

Getting the time a file is created

Can someone show me how to capture the time (ms) it takes to create a file?

 

I am testing the performance on how long will it take to display an image on a web app. I assume there are several ways in getting the time from the GUI side, but there is this JSON file that is created when the image gets displayed.

 

For instance,  user selects the scanned image he wants to view in the web app,  a cache folder is created, then a string of jpeg files are created, (i.e. file1.jpg, file2.jpg, file3.jpg .....then the JSON.file) Once the JSON.file is created the processing stops, meaning the image is generated and is displayed.

 

Can I get the timestamp of the first file created in the cache folder and compare it to the last file created (i.e JSON file) and show the time in seconds in the testcomplete log, this will be the time it took to load and display the image

 

Can this be done using the keywords scripting?

 

I hope someone can help me with this one.

 

7 REPLIES 7
Reshail
Contributor

Hi,

If the image is displayed on the UI you could just calculate the time it took for the user from selecting the scanned picture to it showing up on the web view. You can use the aqPerformance time counter. Here is a link to the doc

https://support.smartbear.com/testcomplete/docs/testing-with/advanced/measuring-test-run-time.html

 

In terms of cache I dont think all browsers allow access because of security reasons. 

AlexKaras
Community Hero

Hi,

 

aqFile.GetCreationTime() returns file creation date/time.

Depending on the implementation of your tested application, time difference you've mentioned might or might not include the time required to render image(s) on screen.

 

P.S. Unrelated, but out of curiosity: if there are a lot of large files and the network is slow (i.e. time difference will be big), what will this mean?

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] 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 Heroes]
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 Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Ned
Occasional Contributor

The files are not big (avg 300KB), it needs to create 256 of these jpg files to get the image to display as expected.

So my curiously was to get the time stamp instead and compare the differences using TestComplete.  That is how I am manually testing this at the moment, getting the timestamp of the first file created in the folder and the last but I want to automate this process.  This is why my question came about.

 

Do you have a sample I can see using the aqFile.GetCreationTime() for getting the two timestamps and comparing it?

 

AlexKaras
Community Hero

Hi,

 

Documentation for aqFile.GetCreationTime() contains an example. To get difference between two dates you may consider, for example, aqDateTime.TimeInterval() and aqConvert.TimeIntervalToStr(). Again, documentation contains code samples.

I would say this is a plain technical answer to your exact question.

 

Exact implementation might depend on your actual needs and requirements and actual desing and behaviour of the tested application. For example, taking time difference between timestamps of two local files, you are not counting the time it took to get the first file. Are there any requirements to count the time it takes to render obtained images and make tested application to become responsive to the user? From the end-user point of view, what is the impact of images loading process? Etc.

 

You may also consider the approach suggested by @Reshail : use aqPerformance object to get initial time stamp, initiate files download process (e.g. by clicking on the selected image preview), wait until the process completes (using whatever criteria that your end-user will use), get second time stamp and calculate time taken.

 

P.S. 300KB by 256 files ends up with something like 75-80MB of download volume... But we know nothing about your tested application and expected operational environment, so it might be fine for you.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] 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 Heroes]
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 Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
sonya_m
SmartBear Alumni (Retired)

Thank you so much Alex and Reshail!

 

@Ned did you get a chance to implement what the Community is suggesting? Please share the solution Smiley Happy


Sonya Mihaljova
Community and Education Specialist

nedbacan
Frequent Contributor

Using the qFile.GetCreationTime(), I was able to get to the current time and compare it to the recorded time in the object that was captured. 

 

Thank you.

sonya_m
SmartBear Alumni (Retired)

Hi @nedbacan, thank you for the update. I am glad to hear it worked!

 

I see that you are using two accounts in the Community. I just wanted to let you know that perhaps it would be more convenient for you to stick to one account since this way you'd keep things like private messages, threads, achievements and badges in one place and see how your account progresses Smiley Happy


Sonya Mihaljova
Community and Education Specialist

cancel
Showing results for 
Search instead for 
Did you mean: