The large cables required to conduct high current are often stiff and, under vibration, tend to loosen the nut on the output stud. Obviously, if the alternator isn't connected to the batteries, then it won't be able to charge them. Verify that battery voltage appears on the positive output stud of the alternator. Also verify that the negative side of the alternator makes a low resistance connection to the negative distribution point of the electrical system. Don't assume that the case of the alternator is the negative output.
Some alternators have floating grounds.
That is, the negative output comes out on a stud by itself without connection to the case. When the system fails to charge, the ignition switch is a good place to start looking. You don't need to look at the switch itself, but you do need to see that the alternator regulator is getting voltage when the switch is on. That is, find an input to the alternator regulator that shows battery voltage when the ignition switch is on, and no battery voltage when the switch is off. Some alternator regulators are enabled via an oil pressure switch instead of directly from the engine.