How to determine the cause of MacBook battery not charging? I see that the question &quot;why is my MacBook not charging?&quot; gets asked a lot. The problem is, there are multiple reasons. Possible points of failure are: charger, cable, magsafe connector, DC input board, logic board, battery. (Have I missed any?).
What is the best sequence for a user to follow, to diagnose the problem?
By way of example, here are the first steps that I usually try:

Make sure the charger is working. Either use your charger on a different Mac, or test a spare charger with your Mac.

Check the connection. There might be gunk in your port that's stopping the connector from lying flat.

Try resetting the SMC and PRAM.

If the computer boots, run Coconut Battery to determine battery status.


This is where I get a bit stuck. For example, I have a machine here that boots fine when plugged in, but not from battery. Disconnecting the MagSafe causes the machine to switch off. Sounds like it's a dead battery, except that Coconut reports the battery as detected, in good condition, but not charging.
What steps should I take next? Specifically, I'm asking for a generic algorithm to help determine the source of the fault (preferably without swapping out lots of components one by one)?
What steps should I take next?


There's only one step to take next:  replace the battery.


  Disconnecting the MagSafe causes the machine to switch off. Sounds
  like it's a dead battery, except that Coconut reports the battery as
  detected, in good condition, but not charging.


It's a dead battery.  Coconut battery can only give you a calculation based on the voltage it's measuring at the time you run it.  It cannot tell you how much charge is actually left in the battery.  There's no "electronic dipstick" to measure the capacity.


Fully charged MacBook Air turns off when power cord removed
Why does a 12 inch Macbook refuse to turn on with a lot of battery remaining unless it is plugged in?


Coconut battery (not a fan and I don't use it) doesn't provide you anything but "a moment in time snapshot" of your battery health.  Thing is, you can get this info right from the command line:

system_profiler SPPowerDataType | grep -i "charge information" -A 10


The problem is, it can't "see" dead cells.  

Algorithm to check batteries


Reset SMC 
Verify that your charger is being detected (green/amber light)
If charger not detected, verify charger/dc in board.  Do this by 


checking for "gunk" then plugging in a known working charger.
If it works - it's your charger
If it doesn't work, it's your system (chances are, DC-In board)