To diagnose constipation caused by abnormal functioning of the anus or rectum, anorectal function tests may be done. These include anorectal manometry and balloon expulsion tests.