It's very quick to change if the SFTP user is the same.
First i would change the user of the new site to the same user as the old site. You will see an option to MOVE the files which is incorrectly worded because it actually copies them.
now wait, until that is completed AND https://www.whatsmydns.net/ shows that the accompanying DNS change for the sub-domain has finished propagating. (likely 4-8 Hours)
When both are operating on the same user....
In WP admin update the URLs for both old and new, reversing them. The save will break both sites. This step MUST be done before the next step.
In your SFTP client:
- rename the test.example.com directory to TEMP
- rename example.com to test.example.com
- rename TEMP to example.com
now one more step, and there is a plugin for it, but WP stores links in it's database as hard links, so those need to be updated.
If both are on the same USER your downtime is just minutes.