I have such MacBook Pro (Retina, 15-inch, Early 2013), and I noticed such "feature": for example, I have 50 (it could be any number) percent of battery, charger cable does not connect. I can surf the browser and make some light work all nice, but if I try to open (for example) Video Editor or some development tools, something that requires more power from my laptop, so my Mac just suddenly turning off... Then if I try to turn it on again I see standard image(notification) like "You need to change your Mac". That's it.
Ok, then I connect the charger to Mac, wait a minute and successfully turning it on... And see that I still have like 50 percent of battery.
Firstiful I think, that I think that I need to change the battery (actually I have 600 cycles), but I am not sure, because as far as I know this battery can easily work up to 1000 cycles of charge, and secondly I tried to find something in google like "Mac turns off, battery issue" and similar questions, but nothing...
So, question is - how can I check if it is a battery issue or anything else?
Image from CoconutBattery app
Image from DaisyDisk
I also tried to run the Apple Hardware Test as @Monomeeth suggested(turn on + hold D or Option D)
The first image that I saw was this one
Then I was asked to choose Wifi and fill in the password and after a few moments I got such message