Asthma is a disease that is diagnosed by history. In other words, one cannot make a diagnosis of asthma the very first time a child wheezes. It's like your friend who show up late to your home for dinner; it would be premature to label them "tardy" after one episode, but if they come late multiple dinners in a row, they are likely "tardy" friends. With every subsequent wheezing episode, the more likely these are not one time events but a sign that there is underlying asthma.
If asthma is suspected, your child may be referred to a lung specialist for a series of pulmonary function tests - this is typically needed in the more severe cases while the milder cases can be handled by an experienced pediatrician. Not only will this confirm the diagnosis, it will help define the severity of the disease.
These tests are designed to measure lung volume and respiratory muscle function, but must be performed correctly in order to be accurate. It's not very easy to measure lung function in small children, which is why pediatricians rely heavily on history. The more episodes of wheezing and shortness of breath a child experiences, the more likely the child is asthmatic.
Another way to diagnose asthma is to start children on asthma medications and see if they respond. If they respond positively, meaning they experience an easing of symptoms, they probably have asthma. If the medication does not help, the wheezing and coughing is probably secondary to a cold virus.
The diagnosis of asthma can be tricky, and while there are tools to help, it requires the combination of history, tests, and serial exams to be as precise as possible.