Asking doctors for medicine

Can you just ask your doctor for antibiotics or do you have to have a reasonable reason? Or they have to run tests on you to give you the medicine?