Update 2022-03-30: My previous answer was updating your code to use an #IF Debug
pre-processor directive as a way to switch into the RunOnStartup=true
method parameter. As of 2022, you can bypass that ungainly workaround and just select an option in the VS Code Azure Functions extension! That seems less complex. There is more information here.

Another alternative would be logging into the Azure portal, navigating to your function app and using the function's Test/Run tab.
OLD ANSWER: There is a good SO question with multiple answers to this same question here.
My test environment is normally my local environment. So if we want to write code that ONLY runs on your local environment and not in production we could use a a preprocessor directive in the middle of the method signature that only sets RunOnStartup=true
when you are in the debug mode.
public static void Run([TimerTrigger("%TimerInterval%"
#if DEBUG
,RunOnStartup=true // When debugging... run the job as soon as we press debug, no need to wait for the timer.
#endif
)]TimerInfo myTimer)
{
Explanation: During local development (debug) the #if DEBUG
block is activated.
It enables the RunOnStartup=true
parameter. In production (not debug) the #if DEBUG
block is hidden.
Clearly not the prettiest code. But much better than the alternatives ... such as having to wait on the timer trigger interval during dev.