For best results, it should be 1 week after you miss your period, but from online research there doesn't seem to be a rule of thumb on how early except if you're in doubt, then go ahead and test.
If your period is regular, you can take test at least one week after your period is supposed to come, or maybe one to two weeks after you've had intercourse.