How soon?

How soon should I take a pregnancy test if I had sex a couple weeks ago? My period isn't supposed to start for another nine days and he didn't cum inside me but I'm nervous.