Testing under lab conditions also provides a stable environment from which you can compare results. In racing you have other factors like environmental conditions that impact time and competition can also impact time. For those that race for place, the competition can mean running slower but winning.
Testing can also be used to see where improvement comes from (depending on the event). For instance, a mile time gets better. Is that because of improvement anaerobic capacity or improved aerobic power?
Testing can also be used to see if training were effective. I like this use of it (although coaches I think fear it on some level). For instance, I finally convinced a coach to pre-test/post-test his athletes following a block of training. I could not convince him that the training he was doing was not improving anaerobic capacity. So we did a modified Wingate test. Sure enough anaerobic capacity improved slightly, but with a maximal aerobic power test (VO2max without the met cart) to measure maximal aerobic power (this was in a cyclist) I showed that he had really improved MAP. Just using the stopwatch would not have differentiated that.