How to run a hardware test on my Macbook laptop
Disconnect all external devices from your PC. Remove Ethernet cable or external drives connected.
Choose Apple Menu >> Restart the laptop and press and hold the D key while the Mac restarts.
Apple Hardware Diagnostic starts automatically. When the diagnostic test is finished, it will list out any problems it finds with a hardware failure reference code. Use this reference code while contacting the Apple support