You will have a 12 lead EKG attached to you and you'll walk, then hopefully jog on a treadmill. The speed and incline will increase every three minutes. A doctor and a nurse will be at your side the entire time.
Yes, it's extremely safe test. They always have a defibrillator on hand and someone is usually behind you to catch you, so the risk is extremely, extremely, extremely small.