There were times when I was trying to conceive that I took upwards of six pregnancy tests all in the same month. Sometimes, I would take two or more in a day. I must've asked my OB-GYN a dozen or more times what can affect the results of a pregnancy test, because I had to know if these results were real or not, especially since my cycle is super irregular. I have pretty severe PCOS, and since I've had kids, it's like that nosy neighbor that you never know when she's going to show up. One month my cycle is 30 days long, the next it's 36, the next it's 33. The only way I know for sure when its close is by my moods and food cravings. Oh, and the giant spot that pops up on my forehead or chin like a shining beacon saying, "Here is a woman about to enter the red tent. Or puberty. It could definitely go either way."
When your cycle is like this, you have a tendency to doubt not only the efficacy of pregnancy test results, but also the lack of craftsmanship considered when your ovaries were being designed. (Mine would've benefited from just a bit more attention to detail.) When it comes to what can affect the results of a pregnancy test, you really need to know.
I found out that my irregular periods weren't that big of a deal in terms of a pregnancy test. The U.S. Department of Health and Human Services assured women that tests can be done with a fair amount of certainty by calculating 35 days from the date of your last period, and testing on that day. This should be ample time, according to their website.
When it comes to other things, like drugs or alcohol, when you want to know what can affect the results of a pregnancy test, the Department of Health and Human Services asserted that the only drugs that affect the results of the test are drugs wherein hCG is a listed ingredient. Those drugs are likely fertility drugs, and you'd likely be on a protocol for pregnancy testing as I was when I was undergoing fertility treatments.
I know that I worried about things like the antibiotics and anti-fungals I took would affect the test, but apparently they don't. Although, they do make birth control less-effective, which, in a way, could affect your test by making it necessary to begin with. Likewise, anti-depressants and other medicines in that category do not change the result of the test. Things like spotting between periods and irregular cramps might actually be a sign of implantation, according to UCSB, so while it won't affect the efficacy of the test, it may mean it's time to take one.
Even terrible aim and peeing on the window of the test won't adversely affect the test. As long as you follow directions, you should get a correct result provided the test is not expired and was sealed properly in the box. Good luck.