A pregnancy test is effective from as soon as two weeks after you last had sex. Check the packet on the pregnancy test to make sure the one you use is effective that soon into pregnancy, or you can see your doctor for more accurate testing.
The pregnancy test doesn't always work to what they make you believe. it can sometimes not detect a pregnancy for the hormones that cause the test strip to react weren't enough. Either, take another pregnancy test, or if you really want to know if you are, go to your doctor and get a blood test.
The best time to take a pregnancy test is after your period is due. It's possible that a pregnancy test might work if you take it a few days before, but it is most accurate on or after your period's due date.