Though MDMA is not specifically tested for in the standard 'SAMHSA-5" drug tests, it is chemically closely enough related to amphetamines that recent MDMA users will test positive in both amphetamines (a common test) and methamphetamines (a somewhat newer and less common test). Because of this, the detection periods for MDMA are very similar to those for amphetamines. Also, many tablets of street ecstasy are not pure MDMA and frequently includes amphetamines (and may also contain DXM, caffeine, MDA, MDE, ephedrine etc) which may trigger drug tests.
Amphetamines are standardly detectable in urine for 24-96 hours after use (72 average). Methamphetamines stay in the system slightly longer, 24-120 hours.