Ocassionally Truck won't Start on 2000 Mazda B2500

Occasionally, my truck won;t start. It is running fine then it won;t start then is fine again for a few weeks. Replaced ignition coils, camshaft sensor, spark plugs, wires, and fuel filter. PLEASE Help me .....Thnaks !

Asked by for the 2000 Mazda B2500
when it does not start, you need spark, fuel and compression. you are missing one of these when the problem occurs. when it does not start, you need to check and find out what is missing, then you can track down the issue

The only problem is I do not know how to check for those functions: spark/fuel/compression