The amniocentesis test is a prenatal diagnostic test (test done during pregnancy) that involves taking a sample of the amniotic fluid surrounding the fetus in the uterus during pregnancy. It is typically performed during the second trimester, between 15 and 20 weeks of pregnancy.