Missing Xcode run test buttons

It happens more often than I’d like that Xcode loses the run test button in the text gutter. Often I’ll resort to closing Xcode and doing various rituals to try and get the little devils to appear again, which is really annoying if you want to avoid context switching.

When you just want to crack on I’ve had success with this flow:

Screen recording showing the above steps described above