The best way to do this is with a 301 redirect from test.com to test.mysite.com. If you are using Apache server, you can do this with a .htaccess settning. For other HTTP servers, please look in the manual or in the appropriate forums here how to do it.
A 301 redirect sends a response to the browser/spider, whenever a page from test.com is loaded. This response contains the code 301 (permanently redirected) and the new address at test.mysite.com where the wanted page can be found. Search engines will only index the test.mysite.com version of the pages.