For a motherboard, the only way to test it is by replacing it. In the case of laptops a laptop replacement is required.
For the memory, there are some tests
Please read below quote carefully and read the tutorial carefully, all common questions are answered in either the post itself or the tutorial.
to analyse your RAM. MemTest86+ - Test RAM - Windows 10 Forums
Make a photo of the result and post it.
MemTest86+ needs to be run for at least 8 complete passes
for conclusive results. Set it running before you go to bed and leave it overnight. We're looking for zero
errors here. Even a single error will indicate RAM failure.
If errors show up you can stop the test, remove all sticks but 1 and test this single stick in each slot for 8 passes or until errors show, switch sticks and repeat.
If errors show up and you see them a lot later, no problem, the errors don't affect the test.
The test isn't updated in a long time, but it doesn't change anything for DDR4
16GB could take up to a day or 2 days to finish the minimum of the requirement