You should do an FTP test rested. This is a very straightforward training principle and the reason that a lot of times when people are actively racing, they're not riding many tests- taking a little break in training to rest up for a test is not necessarily worth it, you can get similar data from racing.
As far as the environmental conditions for the test, they should be as similar to the conditions of your goal event as possible- for example, it you're looking to win Hillclimb Nationals, you should test on your climbing bike up a long climb, if you're a TTist you should test on flat ground on your TT bike, if you're a Zwifter you should test on your indoor trainer. Believe it or not, you actually should have a different FTP set for various conditions in which you would ride/race your bike.
All of that said, there are practical considerations too. If you're riding a long (40-60 min) test outdoors, you might have no choice, traffic wise, but to do it up a hill. And no one wants to take the time to establish different FTPs for different bikes and riding scenarios.
So mostly people understand that there's some wiggle room on the FTP number you come up with anyway, they just ride the best test they can under the most analogous conditions to their goal events possible. And then move on and get the work done.