What do I do if I didn't know about a test?
It's hard to do well on a test you are unaware of. Did you do poorly on the test?
Yes, but I don't think that's an excuse for not doing better.
Maybe you were absent when the test was announced? It's always a good practice to keep up with the work and focus on the class schedule.
Whatever, I got a bad grade.
It's understandable that you would be upset over a bad grade. You can always ask your teacher what you missed in class if you are ever absent. That is a good way to be prepared for class and be sure that you aren't missing something important.