The idea is also discriminatory against poor people.
Receiving welfare is a voluntary process, so your point above is moot. If you are a poor person who doesn't wish to be drug tested, don't apply for AFDC.
I don't know if you know what AFDC stands for, but it isn't for generalized welfare. It's "Aid for Dependent Children." The money isn't to support women who can't or won't work, it's to support the children and infants who are dependent on those adults. The money should be directed to the wellbeing of the children, and not to crack, meth, mj, or oxycontin.
I've worked with a lot of families over the years, both in poor rural areas and in poor urban areas. You'd be surprised how often AFDC is used to support mom's drug/alcohol/cigarette habit. Let's not discriminate. The funds also shouldn't be paying for cigarettes and booze, so we should probably test for those substances, as well.
In my opinion, this doesn't go far enough. Adults who are receiving AFDC should be required to participate in parent/teacher conferences at school, volunteer at the local school, and complete classes in budgeting/finance, food preparation, and employment readiness. Their children should maintain a minimum attendance level (I'd suggest 90%, since after all, we are paying mom to stay home and raise children, so getting them to school should be no problem).
AFDC should be a temporary measure and should be designed to have a longterm impact on poverty. I have zero problems with the war on poverty, but the implementation of poverty-alleviating measures is seriously flawed and has actually become an enabler for many lifestyle choices that are extremely detrimental to children. If we wanted to end poverty, we would work harder on the roots of poverty, which include lack of educational skills or achievement, poor financial choices, poor healty/dietary choices, and lack of employability.
AFDC was never designed to be a lifestyle, but many of the individuals who are longterm recipients were once teen parents and are functionally illiterate. Their employment options are limited and many are trapped in cycles of drug/alcohol dependency, which makes them even less employable.
That money goes out to families to take care of children, but in many cases, it is misused. And, that's a damned shame.