iOS6 update to 8 or greater
You can't.
Due to the limitations of the iPhone 3GS and the design of Apple's iOS, you are unable to update any iPhone 3GS past iOS 6.1.6.
The only way you will be able to test you app is using the iOS simulator on your computer, or using a different iPhone.
In addition, it appears that you will no longer be able to upload 32-bit apps to the App Store, and the 3GS is a 32-bit device. Sorry!