Sometimes dogs and cats have congenital deafness, meaning they are born deaf. In an Australian study, 10.8% of Cattle Dogs had some deafness.

A test called the Brainstem Auditory Evoked Response (BAER) has been developed to test the hearing capabilities of dogs. This test can be used on puppies from the age of six weeks.
In a BAER test, three small needle electrodes are placed under the skin in the scalp of the dog. The electrodes detect electrical conductivity in the inner ear and in the auditory pathways in the brainstem in much the same way an ECG detects electrical activity from the heart. The electrical activity in response to a sound is identified by waves and peaks on a graph. A trace with no peaks indicates deafness in the ear being tested and will even show whether a dog is deaf in just one ear or in both.
Ask your potential breeder if they BAER test their puppies before purchase.

For those looking for more information of deafness in dogs, a review of the study of Congenital hereditary sensorineural deafness (CHSD) in Australian Cattle Dogs is available from the Australian Veterinary Association link below, along with a much more detailed report from BMC Veterinary Research.

A comprehensive website on deafness in dogs and cats is also listed below from the Louisiana State University USA