You had an amniocentesis. This is a prenatal test. It helps you learn whether a fetus has health problems. The test is most often done between the 15th and 20th week of pregnancy. It is also done to check the condition of the lungs of a baby who will be delivered several weeks early.