It's important to note that what matters to do a test like this for HTTP is not really related to DNS at all but what the HTTP client sends as the
Host header value.
The client needs to connect to the right IP address and port, obviously, but beyond that it all comes down to the
Host header which is inline in the HTTP request itself.
For a quick test the following command can be used without changing any operating system level configuration on the client:
$ curl -H "Host: www.example.com" http://192.0.2.17/foo/bar
or, for that matter,
$ curl -H "Host: www.example.com" http://beta.example.com/foo/bar
To do the same with a regular web browser you would either need a browser extension that can modify the request headers (or possibly an HTTP proxy that changes headers), or you would need to change the configuration of the client machine operating system.
As has been mentioned, the easiest means of doing such a configuration change would be to add an entry to the
hosts file. This way the client OS resolver library would get a hit already when consulting the
hosts file and will not even need to do a DNS lookup.
Other options include changing the configured DNS resolver servers on the client to a nameserver which is set up to answer as desired.