Hold on you guys are arguing if the AI is scripted or not? All of the special events are scripted to be tough to a certain degree. The only way to make a test as sterile as possible is to control most of the factors in it. You are the variable added to the entire equation, the AI is specifically geared to whatever test you are in.
License tests are done this way intentionally, they want you to get what they are trying to tell you. They are judging your performance, how you handle the situation the Ai are just the blind road mates who follow orders and do not deviate. First time I heard anyone complain about this license test, I didn't even notice this as I am always trying to be smoother and faster...I never brake early, I let off the gas but braking is all about feel. If the Ai is rear ending you, then you are obviously doing something wrong and therefore slow enough that the Ai is catching up with you. Lesson, be faster and smoother and the AI won't hit you. If the Ai was progressive and tried to avoid you, then you wouldn't have learned to tighten up your driving and increase your attack on that particular corner...thus not using your tires or your car to it's fullest.
The tests are geared to teaching you things in a sterile as possible way, eliminating as much outside interference as possible, the only variable is you.
In other races the AI can be stupid especially when you spin out or get sideways on a course, some may go around you but for the most part they will plow into you. PD needs to fix that, but realistically speaking you getting side ways in a race automatically you getting sent to the rear of the pack, either way you'll be in the same spot. When in real life have you seen a race where a car spins out and retains his position lest he was ahead by quite some margin? Yea doesn't happen. But PD should work on the Ai look ahead and avoid maneuvers, would make for a more realistic scene as cars just plowing into you is plain ridiculous. But the test and special events are fine, you just need to drive, better, smoother and faster.