Typically, only the front end is crash tested ... and this mostly only to demonstrate that the calculation was correct. European crash standard is defined in EN 15227.
It requires the calculation of four crash cases:
1. head impact of similar vehicles at a speed of 36 km/h (22 mph)
2. head impact on a freight wagon of 80 metric tons (79 long tons; 88 short tons) at a speed of 36 km/h (22 mph)
3. impact on a lorry at a grade crossing at a speed of 110 km/h (68 mph)
4. impact on a smaller object like a car at a grade crossing.
In all cases, there must remain a defined space in the cab, which is not affected from the crash. This is some sort of survival zone.
The most difficult case to fulfil is normally case 3. The modelled lorry has the characteristics of a concrete mix truck with a very high centre of gravity at about the height of the train driver. This is the reason, why vehicles fulfilling EN 15227 have these characteristic massive A pillars around the cab window.
All modern vehicles are fitted with anti-climbers, which avoid, that rail vehicles start to raise in case of a crash. This is very dangerous, since the vehicle staying on the ground slits up the floor of the risen vehicle and there is almost no survival chance in the upper vehicle.