A question of testing with dates

ryetee

Registered User.
Local time
Today, 22:12
Joined
Jul 30, 2013
Messages
955
I'm about to test an end of day process. It's uses now() to pick up the current date and time etc.
Is there a simple way without fiddling with the code to pick up different days without actually having to wait for another day!!
I'm testing this on a laptop. Can I change the system date so that Now() will pick that up.
If so how, if not what other options are open to me. As I said I'd rather not change the code replacing now() with different dates.
 
You can use Now()-1 which will give you Yesterday at this time.
It's a small change to make in code but pretty painless for testing.

Alternative is to have a simple table with test values in it , add the table to the query (no joins) and pick the the field value you want. To update the test simply change the value in the one table, not every query based on it.
 
You can use Now()-1 which will give you Yesterday at this time.
It's a small change to make in code but pretty painless for testing.

Alternative is to have a simple table with test values in it , add the table to the query (no joins) and pick the the field value you want. To update the test simply change the value in the one table, not every query based on it.

I like the now() - x if I can remember to reinstate it!

I thought abut the table but it's a bigger change to code.

Thinking on I can set up some public variable with "prod" or "test" in it and control the now() with that so if I forget no problem. Unless I leave the variable set to test! Hmm!
 
Of course for selecting existing records that only works if you had a record created at exactly the same time yesterday e.g. 12:27:53.

If you just want to edit some records to get different dates, do so manually or using an update query.

The normal method for development work is to create a test environment with dummy data so you can test all possible scenarios
 
I decided to change the logic of the program so instead of end of day it's now an end of the last time you did which is actually more what the user wants. Had to change how I held the date to include hh:mm:ss which was the only real hardship. I can now test without having to frig anything.
 

Users who are viewing this thread

Back
Top Bottom