I agree with the posts above. And I'm pretty sure the law of doctor-patient confidentiality will be applicable, especially if you're an adult. I don't know where you're from, but if you want to know for sure I'm convinced you'll be able to find it on google.
Personally, I find not-knowing whether I have an STI much scarier than the test itself. Once you know the results you can deal with them and move on. Most STIs can be cured quite easily with some antibiotics, but HIV, for example, cannot.
I wish you a lot of luck and strength with this. I hope you'll have a good support system to help you get through this.
N.B. I really don't mean to scare you, but for some STIs there is a window period before the test will be accurate. I just wanted to tell you that because my doctor failed to do so. And because of that I went through a huge scare about a week ago, thinking that maybe I had HIV. Fortunately, the test came back negative for me. But especially syfilis and HIV, though you're unlikely to be infected with those, can take from a few weeks to about three months to be accurately measured.
Good luck!