I agree with Zulu. Nothing can be done untill you have charged the battery properly. No point in trying to test a flat battery. All the test will tell you is it's flat. While the battery is charging, see if you can sort out this loose connection problem you say you're having. The sparks won't drain the battery but if the poor connection is on the pos term then charging won't take place nor will you get full access to what power is in the battery. If it's the neg term then again very little or no charging will take place and a lack of good earthing will do all manner of silly things to the electrics. Look at a rear light cluster when it has a poor earth???? Turns it into a disco light with all lights flashing when you brake and indicate. Same thing happens to the alternator and starter if you have a poor earth ( neg term ) on your battery. One won't charge n the other won't turn properly!!!
Ok so battery fully charged. Now you have two options, 1 take the battery down if you can scrounge a lift to a decent place that sells batteries and have yours drop tested. They will be able to tell you if the thing is ok or has passed it's sell by date in a few seconds. If it has then you can get a new one there n then.
Option 2. A bit hit n miss this way but it will give you an idea if the battery is on it's last legs. Like Zulu said, put your headlights on ( full beam ) get some one to try to start the car while u watch the lights, if the lights dim to a decent level and the starter is sluggish in performance while cranking the engine then the battery needs to be replaced.
The lights will dim slightly because even when everything is tickety boo on a car and the starter kicks in it makes use of around 75% of the power in the battery to get the engine started, a huge draw on a battery.
Another good indicator of a knackered cell is a cold snap over night. You think you have a good battery??? lol!!! And then a real cold front hits at night n you come out next morning expecting to go to work, but, instead a call to the motoring club takes place or the jump leads come out. But once things warm up again and you've been driving the car it starts no worries and works fine for days till the next cold one hits and the same thing happens again. If you don't know this it'll drive you round the bend thinkin why does it start sometimes n not nothers?? lol.
If the battery checks out ok or you put a new one on and it still keeps going flat after a while of sitting or over night then have an amps draw test done on it, you could have something pulling power while it's all supposed to be switched off. I won't go into how the test is done now but if you have a multimeter then I'll be happy to explain how it's done.
Good luck fella, hope it gets sorted