testing when

How early before period can you test for pregnancy? Thanks in advance