As far as I know, your car did not fail the test but rather was not ready for inspection. Failing the test means your car's emission levels are beyond allowable values for a particular state. In most states, a car will not be tested if SRT is not complete or CEL is ON. In CA, 2 parameters in NOT READY state is acceptable, provided the CEL is OFF.
The System Readiness Test (SRT) may be 'tricky' and take a while, especially if you don't know how the different sensors are set to READY state. If the ECU has been reset (thru an OBD II scanner; by disconnecting the battery for extended period; or manually thru the ECU itself) or if CEL just turned off, parameters in the ECU are set to NOT READY state and the car has to go thru a warm-up, constant speed and stop-and-go cycles to change from NOT READY to READY state. The best way to find out if your car is ready for inspection or not is go to to Autozone and the likes and have a free OBD II scan. Assuming there is no trouble code stored, the scanner will indicate if SRT has been completed and if not, which parameter(s) is NOT READY.
I'll try to explain it as briefly as possible. Start the car and let it idle for @ 2 minutes (open loop, O2 sensors not being used by ECU) and once the coolant temp reaches @ 158C/70C, the O2 Sensor Heater is set in READY state (the ECU will start using the O2 sensors - closed loop) . Driving the car on a highway for 10 minutes @ 53-60 MPH sets EGR, O2 Sensors and Catalyst to READY state. Driving the car on city streets for 6 minutes @ 30-35 MPH with 5 FULL STOP and GO sets EGR-BPT and Evap Purge Flow Monitors. After city driving, 3 minutes of highway driving at 53-60 MPH sets EVAP Small Leak Monitor to READY. At this point, SRT is complete.
From above, you can see that you can drive hundreds of miles but if you did not maintain the required speed, some of the parameters will remain NOT READY. The hardest part is highway driving at 53-60 MPH with cars passing you on left and right and other drivers probably giving you a one-finger salute. And as always, make sure the engine has been driven several miles and warm before taking it for inspection to reduce emission levels of HC, etc.
Please refer to page EL-82 of the attached link for more info.
http://www.nicoclub.com/FSM/i35/2002/ec.pdf