As with almost anything to do with dogs be it dog training or dog behavior there are several different options on how accurately dogs can be tested for temperament or aptitude. There are a group of very respected trainers, researchers and dog behavior consultants that believe that there are specific test that can be given to juvenile to mature dogs that can accurately predict how that dog will mature and what he or she will be suitable for with regards to training, obedience and ability to be well socialized. These individuals don't discount the early experience of the dog and how he or she is treated, rather they look at what the dog, if raised and trained properly, has the potential to become.
The second and perhaps more well known opinion is that dogs are basically a product of their environment. This is the "there are no bad dogs" camp that truly believe that temperament and aptitude within a particular dog is directly influenced and almost solely controlled by early training, positive interactions, bonding and of course physical ability. This group does, however also agree that there is some hereditary component to behavior, but it is not the greatest factor and certainly not the most influential overall.
Most organizations or groups that offer temperament testing have a set series of tests that the dog is put through to determine how he or she reacts. The response of the dog is then compared to both typical responses within a specific breed as well as across a normed group of responses by other similar dogs. Tests are usually conducted by direct observation of the dog and the handler does not give commands or cue to the dog on how to respond. Typical tests will include having the dog walk through a group of test subjects and through a specific course. During this walk the dog will be exposed to people walking close to the dog, sudden noises, visual objects such as opening umbrellas and flapping flags, walking on unusual surfaces such as bubble wrap or gravel, or even having the dog walk over a very low board teeter-totter. Other issues can include having testers approach the dogs dressed strangely, making weird noises or even sounding aggressive or threatening.
The testers are looking for any signs of abnormal aggression, fear or shyness as well as the dog's ability to move forward on the walk. There are usually both positive, neutral and somewhat negative aspects to the test but the dogs are not physically touched or intentionally frightened during the test. Based on how the dog responds they are scored and the owner is provided feedback on the dog's overall temperament.
Aptitude is a bit different than just temperament. It is, in fact, what the dog has a natural ability to do. One would expect a Border Collie to be able to catch on much more quickly to learning to herd or work with livestock, just as a Bloodhound owner would expect his or her dog to be able to track somewhat naturally. Dogs that have a natural aptitude can be found in every breed and generally all dogs could be taught almost any specific task if the owner had the time and the energy to work with the dog. It is likely that very early breeders recognized the hereditary component of specific types of aptitudes in dogs and bred for those very traits. With time and with breeding for dogs other than working animals, many of the lines even within a given breed have a diminished aptitude, even in what may be considered their natural field of expertise.
Over time and with breeding for physical appearance rather than hereditary aptitude or even temperament many breeds have now diversified into a show line and a working line. This is particularly true in the hunting or sporting dog group. Most of the Retrievers, Spaniels, Setters and Pointers have a working dog section, known as the field lines, and a show line group which are bred more for appearance and companionship. It is very possible for a Golden Retriever from a show line to have little natural aptitude to hunt or retrieve, especially if the line is well established and has not been used as a hunting line. This is not to say, however, that with training that same dog wouldn't learn retrieving skills much more easily that a non-retrieving breed.
Some breeds have started out as a working dog or a sporting dog and have slowly evolved into a companion dog, quite different than their not too distant ancestors. The Standard Poodle is a good example of how the aptitude and temperament of a traditional retrieving water dog has been molded into one of the most intelligent and beloved companion dogs. The Standard Poodle was originally used in Europe as a gun dog, and their thick curly coat kept them warm even when getting in and out of water in winter conditions. However the Standard Poodle was also an affectionate, loyal and very smart dog and soon became a general all round dog on farms and rural areas. As the breed became more popular there was an increasing demand for smaller Poodles, which lead to the development of the Miniature and Toy sizes so popular today. It is highly unlikely that you will see these dogs out in the field retrieving ducks for a hunter, yet the temperament and aptitude of being friendly, highly intelligent and very loyal still is evident in the breed today.
It is very probable that temperament and aptitude is both hereditary and environmental and varies between individual dogs within the same breed. There are some lines of working dogs, including police and military dogs that have been bred for generations just for their exceptional natural abilities. Other dog breeds have also been bred within special lines that create the championship working dog seen as the ideal for the breed. Even with all this hereditary influence if a puppy or dog is ignored, spoiled, mistreated or abused they are likely to not reach their potential, at least with that owner. Many dogs that are taken into rescues or are removed from abusive situations become outstanding dogs, but unfortunately there are others that are both emotionally and physical damaged beyond recovery. Sometimes both of these outcomes can be seen from puppies within a given litter, so there is some definite individual aspects to both temperament and aptitude that still need to be fully explored to be understood.