Macbook Pro 2011 A1278 Keyboard Diagnosis
You are lucky to have a keyboard that lasted 7 Years.

Normally their life span is much less, and it depends on your eating habits (yes, eating, believe it or not). 

Best way to keep it clean and last longer in the future


use compressed air can from time to time
buy a ~$6 transparent cover foil made to fit your model keyboard
replacing individual keys is possible if you are a surgeon
no comment on eating habits


As for hardware test, use the builtin Apple Hardware test. That might show a problem or not.

Hold D key during restart and follow the instructions.