david_taylor
11 years agoNew Contributor
Options to store the actual date before the system date is set to another date
Hi
I am using TestComplete 10 with a DeskTop module. I have some scripts that use aqDateTime to change the system date.
I want the tests to set the system date back to the actual date at the end, but I am not sure the best approach for this.
eg.
I have looked at setting a temporary project variable value that gets the date before it is changed by a test, however that requires a script to be run to set the value. I really wanted the value set before any test or script is executed.
Is it worth persuing a way to do this through variables, or is there another way this can be done (ie getting the actual date from the internet)
I am using TestComplete 10 with a DeskTop module. I have some scripts that use aqDateTime to change the system date.
I want the tests to set the system date back to the actual date at the end, but I am not sure the best approach for this.
eg.
Todays actual date is 22/10/2014
System date is changed to 09/09/2002
System date is changed back to the actual date (22/10/2014)
I have looked at setting a temporary project variable value that gets the date before it is changed by a test, however that requires a script to be run to set the value. I really wanted the value set before any test or script is executed.
Is it worth persuing a way to do this through variables, or is there another way this can be done (ie getting the actual date from the internet)
- Hi David,
You may implement the code that gets the current date/time and stores it into the temporary project variable in the OnStartTest event handler. This will guarantee that you will not need to execute some separate test code to have the variable to be populated with the value.