Hysterosalpingogram (HSG), is one of the earlier tests used in the treatment of infertility, usually after a couple has tried a year of unprotected sex with no success at conception.
An outpatient procedure, it is relatively painless, although women with more sensitive or tightly closed cervixes may be sedated with Valium ahead of time and given anti-inflammatory medications for the pain afterwards, which is similar to menstrual cramping.
A speculum is inserted as in a standard gynecological exam and through a small catheter, an injection of 'contrast' or dye is released into the uterus. The doctor then manipulates the uterus slightly to make sure that the contrast is evenly distributed. An x-ray is taken and the doctor is able to see from this picture whether or not one or both fallopian tubes are blocked, which would certainly hinder conception.
Hysterosalpingogram must be done around day 10 of a woman's cycle, to insure that she is not pregnant, as the contrast would do harm to a recently implanted egg.