Heres how you can test weather it is the battery. First off the alternator is like a generator so if your car was running and then died, the alternator is probally shot and then it ran off the battery until it was dead... But heres what you can do to test both at home.
Jump start the car, and after its running, disconnect the negative terminal to the battery, If the car dies, its the Alternator. If it stays running its the battery. You get what I am saying. If you have to jump start the car and the car stays running after you disconnect the negative battery terminal than you need a new battery. Keep in mind batteries for cars only last about 3 years. Good luck