Bug/Defect Life Cycle
The defect need not be found only during the testing stage, it can be found at any stage of SDLC or STLC.
Whenever a bug is found, it is logged in the Defect Tracking system and assigned to some developer / programmer. The developer / programmer fixes the bug and changes the status to resolved and assigns to tester. The Tester re-verifies (confirms) it and if it is fixed, closes it or if it is not fixed, bug is reopened and assigned to the developer again.
There can be many stages included in the above cycle like deciding the bug priority or severity or to check if it is really a bug or just a requirement etc.