As addition to @toscho's excellent answer, I will add several things...
======== Safety ========
Always be careful with safety. If you try to use any test site in this manner (with many sites paralelly) and on that test site you'll install any crappy/suspicious plugin, which might infect whole WP-Core, then all your other sites will be under risk (although,that risk similarly exists even while you use completely separated installations). This is just a small thing, however, dont worry much about it (because worrying wont help at all).
======== Needed steps to setup on Localhost =======
To point subdomain to main WP-INSTALLATION (while just using special
wp-config.php), you need to set-up
Alias commands in webserver.
1) Go to
..wamp\bin\apache\apache2.4.9\conf\httpd.conf and uncomment this line:
extra/httpd-vhosts.conf add (just modify to your specifics. In the below example, I use already setup domain name
localhost... however, you can add anything)
#UNCOMMENT_THIS_LINE_ONLY_WHEN_YOU_NEED_SUBFOLDER_TOO# Alias /subdirectory_name C:\wamp\www\wp_installation_folder
CustomLog "logs/4-access.log" common
3) [You dont need to do this step if you use
localhost name] In case you with to use you anything other than
localhost, then you should point that name in
C:\Windows\system32\drivers\etc\hosts, like:127.0.0.1 myexample.org`
Restart WampServer and that's all