At pill testing, user submits a sample (entire pill, or scraping at user's choice. Larger sample = more accurate result).
If it tests for ecstasy, they'll give a white result and tell you there is a risk it could contain other products (that aren't in library for testing (which is over 30,000 chemicals), they'll also advise MDMA can be hazardous to your health and the risks associated with taking it.
If it gets a yellow label, its not what is expected (MDMA), and they'll tell you what has been detected (e.g. paint etc)
If it gets a red label: it is not what is expected (MDMA) and could belong to a category of drug that is known to cause deaths.
source:
https://www.abc.net.au/radio/sydney/programs/drive/david-caldicott/10602846
Couple more links that clear up some of the misunderstandings:
Model where counsellors provide risk-reduction advice backed by 63% of sample
www.theguardian.com
The pill testing debate seems louder than ever. We look at recent claims from politicians, commentators and experts — and put them to the test.
www.abc.net.au
It also important to remember that pill testing also gives information on what types of drugs are out there in circulation, and this better helps inform health care professionals when there are things like overdoses and what appropriate treatment actions can be taken.