About a year ago I needed a new mattress.
There's no way to test before you buy IMO. You need a night at least to tell, I know that some companies offer trial periods but I bet they argue about returns and even if they don't, what a faff to sort it out!
The first decision I had to make was whether to get foam or a traditional mattress. I bought a foam mattress topper and after a week I saw that it was too hot. It was a waste of money in a way, but at least it taught me that foam is not for me.
Next I decided that the only rational thing to do was to let Which? decide, I mean at least there's a modicum of objectivity, so I found their most recommended traditional mattress and looked on line for suppliers.
And from then on things simplified, because there were companies who would deliver quickly, install in the room and take the old mattress away. They were really a pleasure to deal with and good value for money to boot.
That was a year ago and I have no regrets.
In fact, when you get a new mattress you realise how saggy your old one has become. The process of online purchase was so easy and pleasant that I resolved to repeat the procedure every 7 years, whether I felt any pains or discomfort or not.