There are those who will argue that the first thing you should do, if you have the equipment handy or are willing to rush out and buy it, is to clone the hard drive suspected of failing and then you have all your existing data, etc. Realistically speaking, many home users are not going to have a spare drive hanging around nor be inclined to rush out and buy one. If you already have an external backup drive and have been taking regular system image backups then this is not quite so necessary, as you can restore from the latest of those.
If you don't have an extant backup, whether system image or user data, on an external drive (or media of some sort) and you don't intend to get a spare drive for cloning then you should extract your user data first on to the external media of your choice.
A drive could go completely belly-up at any time when you're extracting data, cloning, or running a diagnostic and it's critical that you do what you can to preserve your data prior to doing anything else.
A great deal of your decision making process will be based around how precious the data that's on that drive really is. If it's disposable or backed up then you can pretty much have at it as far as running diagnostics.
Brian AKA Bri the Tech Guy (website in my user profile) - Windows 10 Home, 64-Bit, Version 1803, Build 17134
Memory is a crazy woman that hoards rags and throws away food.
~ Austin O'Malley