The recommendations are usually to measure the stitches over 4 inches so you usually cast on 30 or so stitches. Depends on your yarn though. Fingering would require more, bulky less.
It is also generally recommended that you wash and dry your swatch. A lot of people don't do that though. It could make a difference if your yarn is something that stretches out easily or might shrink.
You need to come as close as possible to the gauge recommendations for the pattern. 1/4 stitch off every inch is 1 inch extra every 4 inches. Do the math to figure out how much it is over your own measurements.
Here's a good info page about the whole thing.