Most states run the test as per the federal test procedure. The check engine light must illuminate at key on with the engine off. The vehicle is started and the light should go off if no codes are in memory. That is the first part of the test. The next part of the test is the # of monitors that are ready is looked at. Most states are set up to allow 2 monitors not ready and the vehicle will test. If not enough monitors are ready in some states the vehicle will fail in others it is rejected. Monitors looked at are EVAP, O2 Heater, O2, Catalyst,and EGR. In order to run the monitors a (DRIVE CYCLE) must be performed. A drive cycle is a certain way the vehicle has to be driven; because a monitor is actually a test the computer is running to check a certain component. Say it might turn on the EGR ansee what the change is from the MAP sensor or the O2. You might try the dealer for a copy of the drive cycle or even google it. Follow it precisely and don't skip any steps. You may look at getting a n extension on the truck or a waiver at this point. The link is for your states laws on emission testing.
http://www.nydmv.state.ny.us/vehsafe.htm#einspect