I went out this morning and my car wouldn't start, when I turned the key the lights all went out and after a min or so came back on, the under hood light had some power but was very dim and then came back on bright so I tried the key again and the same things happened. After work I replaced the starter and solenoid thinking that was probably the problem but after replacing them I still had the same problem so to check the starter I used jumper cables from the battery to the starter wire on the solenoid and it spun the motor so I tried it again with the key on and it started up, so I backed it in the garage and let it run for a few mins. and turned it off and tried the key and everything worked, started right up, did that 4 or 5 more times and had no problems. I don't want to go somewhere and have it not start on me so I'm a bit worried about driving it, any ideas what might have caused this or what to check. The old starter was bad, bench tested it and all it did was hum. I do have an alarm on the car and I replaced the connectors for it at the battery before replacing the starter.