Genetic Screening/Testing

On my 10th week appointment my doctor asked if I was interested in doing the genetic testing which means they’ll be testing for birth defects and such. You could also find out your baby’s gender this way. But does anyone know how it’s done? Has anyone else done it? Is it a risk for miscarriage?