Unfortunately, that is largely impossible. Too many pregnancies are unplanned, its too unpredictable. Whether anyone wanted to require a test or not, it wouldn’t matter. What would we do with those who failed and still got pregnant?
There are parts of the world where the population continues to grow (not to mention HIV rates) and they have no idea where babies come from.
So the true test is after the baby is born, and hopefully there aren’t many people that flunk out at that point.
Life’s the only school where you take the test before you learn the lesson, and child rearing is no exception.