Should a test server be hosted locally or on the internet ? What are the pros/cons? I have seen people do both. What is best practice?
It should be hosted where everyone who needs to test can access it. Important is that everyone can test in isolation, you don't want different processes or users interfering with each others tests runs.
As you tagged this question with "continuous integration" I would like to add that for automated tests I love to spin up a test environment from scratch so all the tests run 100% in isolation on a clean system. Automating the bootstrap of your environment with something like Vagrant could make this relatively easy.
In most cases you want to simulate your production environment as close as possible. As a manual tester you want to get the same feeling your end-clients are having. I think reporting on usability (including how smooth it feels) is just as important as finding functional defects. So hosting your test environment in the same datacenter and on similar hardware would make sense in this case.
Pro's for internet:
- Easy access
- Possible similar to end-users
Con's against internet:
It really comes down to overall reliability and speed.
If you can guarantee that you have 24/7 access to your 'test server' via the Internet, with guaranteed > 10Mbps download/upload speeds, and you can protect 100% from external attacks (e.g. DoS) then the Internet might be the way to go.
But, if you are like most of the world that experiences inconsistent connections, periodic slow connections, etc, then an internal server might suit you better.
Additionally, if you are going to be doing things like fault injection then an internal server might be a better choice because you have greater control over it.
If you have 'protected' test data or other sensitive information that you don't want folks outside your org to potentially access then an internal server might be a better choice
If you want to emulate real users...use the same Internet services they use; don't attempt to emulate or simulate them by creating a mock service on the Internet.