From a coaching low level rider’s perspective: I find different students need to ride through a test more or less often. I have never had a horse anticipate transitions. But I have had riders get thinking too far ahead.
With most: I talk them through a test once when we first start to think about competing at a show (to help pick the best test). We find the weak points of the test and work on the elements that need the most help over the next few lessons. Then we ride through the test in the week or so before the show. We walk through it once (saying the gaits and transitions) and then properly ride it.