This is a common backyard mechanic technique to test if your alternator is working. In theory, if your alternator is working and providing power to the car while charging your battery, then once the car is started, disconnecting the battery shouldn’t cause the engine to stop running. If it does, then there’s a possibility that your alternator is not functioning, or a connection to it is not working or it is working intermittently. HOWEVER! Be aware that this test is not without risk to damaging your car electronics. If your alternator is malfunctioning and over charging your battery, disconnecting it may allow the alternator to provide an even higher voltage to your car electronics and potentially damage the electronics. Also, if your alternator is providing power intermittently, it may cause the computer lock up producing other problems. Therefore, this test is safest if not performed at all. You’re better to use a voltage meter and measure the voltage at the battery when the car is off and when it’s running. In simple terms, if the voltage is higher when the car is running, then the alternator is providing at least some energy back to the battery.