The Apple Hardware Test (AHT) is a comprehensive application that can help diagnose hardware-related issues you may encounter with an older Mac. The AHT can diagnose issues with a Mac's display, graphics, processor, memory, logic board, sensors, and storage.
How to Use Apple Diagnostics on Your Mac to Find Hardware Problems
Some Mac problems, such as startup issues, can be caused by software or hardware issues. A good example is getting stuck on a blue or gray screen when starting up a Mac. The reason your Mac is stuck can be a hardware or software problem. Running the Apple Hardware Test can help you determine the cause.
Apple hardware fails from time to time, with the most common fault being RAM. For most Macs, RAM is easy to replace, and running the Apple Hardware Test to confirm a RAM error is a simple task.
Not all Macs run AHT. For those that do, the method varies depending on the version of the operating system installed on the Mac.