Samsung Members has a free full hardware test. Great for checking a used phone before buying or after a repair.
1. Open the Samsung Members app (install it from the Galaxy Store or Play Store if it's missing).
2. Tap Support, then Phone diagnostics.
3. Tap "Test all", or pick single tests: battery status, touch screen, speakers, microphone, cameras, sensors, Wi-Fi, mobile network, charging and more.
4. Follow the instructions for each test. Anything marked failed needs a closer look.
On many Galaxy phones you can also dial *#0*# to open the built-in test menu (touch, display colours, speakers, sensors).