Administering a code test is as simple as sending candidates an e-mail with the instructions and any necessary additional resources they will need. Be clear about the time frame in which you expect an answer; a week is usually plenty of time.
Code tests can be administered at a variety of points during the hiring process, and determining when that is depends on what's convenient for your company and what makes sense for the individual position. In general, for lower-level positions where you'll receive more resumes, it makes sense to administer code tests earlier in the process as a quick way to narrow the field. If you have fewer interviewing resources, it also makes sense to do code tests before the phone screening.