Yes, it is possible - I run a drupal site at http://www.blah.net, and a development/testing one at http://dev.blah.net. They both use the same code, checked out of a shared svn repository, and they both use the same database.
This works fine for me, based on the following conditions:
The line of your settings.php that defines $base_url needs to be commented out.
The line that defines $cookie_domain needs to be replaced with a conditional on the server name, to prevent logins from going freaking crazy.:
if(preg_match('/dev/i', $_SERVER['SERVER_NAME'])) {
$cookie_domain = 'dev.blah.net';
} else {
$cookie_domain = 'www.blah.net';
}
While this is all fine for me, that is because my paths map exactly the same way (the drupal apps both sit on the root of the domain). I originally had www.blah.net/dev, but that broke because paths just don't work anymore.
Soo, the solution is to make sure the paths map. Do you possibly have sufficient access to implement an Apache VirtualHost on the site you want to test on? If so then you can add a virtualhost entry like this:
<VirtualHost dev.blah.net:80>
ServerName dev.blah.net
ServerAlias blah.net
DirectoryIndex index.php
#change this to the path to the drupal install
DocumentRoot /www/htdocs/
<Directory "/www/htdocs">
## Allow CGI and Symbolic Links
Options +FollowSymLinks +ExecCGI
# NOTE - The FileInfo override allows rewrites to work in htaccess files
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Another note is that while you can maintain seperate templates and physicall files without any problem, if you change the configuration through the admin panel, those settings are stored in the database, and so will take effect on all installs sharing the database. Blocks are a typical example of this problem, since they are stored on the database.
Basically you cannot have two different sets of path mappings for drupal (granted, you might be able to do some insane apache rewrites, but that would get very messy). The virtualhost answer is probably the least painful solution, providing you have sufficient access.