testing the connection only tests the ability for dreamweaver to make an FTP connction.
it has nothing to do with the Web URL
When you test the database connection it places files on the site, then uses the web URL to access them
the 404 error means that the web URL is pointing to a different location then the FTP connection is connecting to.
make sure to use the proper URL for the Web URL in the testing server settings.