As long as possible. However, the duration of this test varies from patient to patient. The stress test usually lasts about 5-10 minutes.
More about the stress ECG.