A pregnancy test is a medical test that determines whether a woman is pregnant by detecting the presence of the hormone hCG in her body. This hormone is produced by the placenta shortly after the embryo attaches to the uterine lining and is present in both urine and blood.