An HSG is a test often recommended during initial evaluation of infertility. It is an x-ray that looks at the inside of the uterus and the fallopian tubes. A small tube is placed in the uterus through the vagina and dye is injected while the x-ray is being performed.