local server or web server for test? Then move online best practice

Just wondering the best way to set up wordpress for comprehensive testing – on a web server or local server? With the intention to finally move the site to a web host once fully functional. I have had a lot of trouble moving wp before and tips?