Testing events in a loop