Because the manufacture of ecstasy is unregulated, you could end up with a batch that contains more or less of the substances you expected to find. A typical ecstasy pill should contain mostly MDMA, but recent batches on the street have been found to also contain the following (and little to no MDMA): caffeine, dextromethorphan (DXM), piperazine, methylone, MDEA and MDA, 4-MTA, LSD (a psychedelic drug), 2-CB, ephedrine, aspirin, atropine, amphetamines, PCP, cocaine, and ketamine.
Therefore, testing a pill in the lab is the only way to be truly sure of the contents of an ecstasy pill.