Randomised Controlled Trial - essentially, take a population, give half of them the vaccine, and half a placebo, and study the reaction.
What you're referring to (voluntarily infecting people) are challenge trials, which are also being discussed, but are still somewhat ethically dubious.