Hi, I’ve just run into the same problem, and wanted to share my solution:
Apparently, the World does not tick during AutomationTests. This means that the TimerManager does not tick either, so the Timers obviously do not advance. My solution to this issue is to manually tick the world in my test:
GFrameCounter++; // artificially increase the frame counter
GetWorld()->Tick(LEVELTICK_All, DeltaTime); // tick the world (and anything in it)
// assert result of "async" task
Incrementing the GFrameCounter
is important, because the TimerManager checks that it does not tick multiple times within the same frame. By incrementing the frame counter, the TimerManager can then actually tick multiple times.
Note that the very first tick on the TickManager will not actually execute your task (even if start delay is set to 0). Instead, the first tick is always used to move the task from status “Pending” to “Active”. Only on the following tick will the TickManager then process “Active” tasks. So you will likely need to call Tick on the world at least twice. On the second tick, you can specify an arbitrarily large DeltaTime
, and your task might then be called multiple times, if it has a lower rate and is configured to loop.
The next important thing to realize, is that manually calling Tick()
will (synchronously!) call the TimerManager and have it process any submitted tasks. This means we actually DON’T want to use LatentIt
. You can simply do your assertions right after the Tick()
call in a regular It
!
Hope this helps :).