You can test the animals on a reasonable basis, say once per 6 months, or once per year, or longer, depending on the farm practices. E.g., a closed herd (no outside animals are brought in - the only animals are the babies of animals already on the farm) - in that case, then after 3-5 years of negative tests, the testing basis could be changed to once per 3 years or once per 5 years.
But, for the milk? You have to test it from every cow, every day. Believe it or not, there's cow shit in pastures or wherever the cows are. And, believe it or not, sometimes cows lay down. All it takes is contact with contaminated waste, and incomplete cleaning of the teats, and you have infected milk. I would think that if the person involved in the milking process knew that the milk was going to be consumed raw, that they would double the efforts to make sure the environment was as sterile as possible during milking. But dairies don't have just 1 or 2 or 3 cows. They have hundreds or thousands of cows, and the guys milking them aren't usually making a heck of a lot more than minimum wage. So, given that reality, I wouldn't touch raw milk, except from a hobby farm where the owner is the one who does all the milking, and the owner is especially awre of the health risks of contamination.