The best way to test a crankshaft sensor is when the system is not starting, and every time I’ve tried to do this, the sensor started working again before I could find anything.
There aren’t many times I suggest to just toss a part at it, but this is one that I would (and have done myself in the past,) with success.
It may not be your answer, but a new part would go a long way in ruling it out.