Historically, paternity had been established by a series of legal presumptions. Naturally, the husband of any woman who gave birth was presumed at law to be the biological father of the infant. However, where a woman was not married, law generally presumed that the individual identified by the mother was the father of the child, as long as there was other evidence (such as temporary cohabitation) that supported the allegation.
However, it was clear that in many cases, that women were misidentifying biological fathers. Moreover, it was highly suspected, but difficult to prove, that many married women were giving birth to children who were not the offspring of the woman's husband. However, there was no scientific method by which this could be proved. As the law existed, men were often required to support infants who could not definitively be identified as their own children.
By the 1920s, blood types were well enough understood to have a genetic basis so that certain paternal/maternal pairings could be definitively ruled out given the range of blood types in the offspring. In other words, infants inherited their blood type antibodies - A, B and Rhesus+, from one or the other of their parents. If for example, the infant's blood type was AB-, the mother was A- and the presumed father was O-, the presumed father could not possibly be the biological father as the B antibody must have come from the biological father.
However, the early test was often not definitive. For example, if mother, father and infant were all type O-, this would not rule out the possibility of paternity, but could not prove it.
Since the advent of DNA typing, paternity testing has become much more definitive. Instead of testing just three genetic markers, which is the case with blood type testing, dozens of possible gene matches can be compared over a wide range of values. Persons who are not related will very quickly be eliminated from the possibility of paternity, and persons who are related can be matched to a very high degree of confidence. It is not difficult to match with a confidence exceeding the number of individuals on the planet, or to put it another way, the odds of finding another individual on the planet with an identical match are less than 30%.
In Paternity, House performs a surreptitious paternity test on both parents of the patient to win a bet that the father is not the patient's biological father. However, the test also indicates a clue that leads House to the correct diagnosis.
In Maternity, a woman tricks her husband into taking a paternity test because she is not sure if the fetus she is carrying is actually his child.