Generally, persons subject to pretrail release are required to be tested on the first time that they go to pre-trail services. If your friend has already been to court she should read the conditions attached to her release bond to see if the judge ordered random testing. If so, she should be prepared to give samples at each visit and may expect to be asked to come in on short notice to provide samples.
On the positive side, her attorney may refer to a history of clean tests as a basis for asking the court to sentence her to probation if she loses her case.
If your friend cannot stay clean, she should discuss this with her attorney as soon as pssible. Failing a test could result in losing her bail or if she loses the case being sent to prison. Good luck!
THESE COMMENTS ARE NOT LEGAL ADVICE. They are provided for informational purposes only. Actual legal advice can only be provided after consultation by an attorney licensed in your jurisdiction. Answering this question does not create an attorney-client relationship or otherwise require further consultation.