When can I take a test?

My boyfriend and I had sex on March 9th and on the 19th. Both times he did not pull out. Is it possible I could be pregnant? And how soon can I take a test?