One way around this issue is to create testdata with whatever dates you want, including the current date and change the logic of your application to rely on a Utility class property:
Date todayDt {
get {return todayDt == null ? Date.today() : todayDt;}
set;
}
and everywhere in your PROD code when you need to reference "today", you don't use Date.today()
but instead Utility.todayDt
Your testmethod can thus create testdata with audit field dates to whatever you want (from today onwards) and then before you toexecute test.StartTest(), do
Utility.todayDt = Date.today().addDays(180); // example - for creating testdata with audit dates 0...180 days in past
Your PROD code will think that "today" is 180 days from the real today but as long as all references to Date.today()
are changed to the Utility.todayDt
; everything works. Sort of a "back to the future"