Bug fix
A bug fix is a change to the code that corrects a defect, so that the software does what it was meant to do. Bug fixing is the work around that change: reproducing the failure, finding its cause, changing the code, proving that the failure is gone and shipping the change in a release.
The longer version
The fix is the last of three steps. The ISTQB Foundation Level syllabus, version 4.0.1, describes the typical debugging process after a test has triggered a failure as reproduction of the failure, diagnosis, which means finding the defect, and fixing the defect. The order matters, since a change made before the cause is known may quieten the symptom and leave the defect in place. Take a booking page that shows some appointments on the wrong day. The failure is the wrong date on the screen. The defect is in a shared function that applies the user's time zone offset twice. A change on the booking page that corrects the date there by hand makes that page look right, and the confirmation email, which calls the same function, goes on showing the wrong day. A fix corrects the function, and the page and the email both follow. The syllabus keeps the two activities apart: testing triggers the failure, and debugging, which it calls a non-testing activity, removes the cause.
A fix is complete when five things exist, and the code change is the first of them. The second is a test that fails on the old code and passes on the new, which is the test that would have caught the defect had it been there earlier. Kept in the regression suite, it stops the same defect from coming back unnoticed. The third is a retest: the steps of the original report are run again on a build that contains the change. The syllabus calls this confirmation testing and says it is preferably done by the person who performed the initial test. The fourth is a regression check of the behaviour around the change, since a correction to shared code can break another caller, and how the retest and the regression run differ is set out under regression testing vs retesting. The fifth is the release. A fix that is merged and not yet deployed has changed nothing for the person who reported the bug, so the report stays open, or is marked as fixed in a named version, until that version is live. A fix too urgent to wait for the next scheduled release travels as a hotfix, which has its own entry.
A workaround is a different thing. It is a way of getting the job done while the defect is still there: use another browser, export the list and sort it in a spreadsheet, ask support to make the change by hand. Nothing in the code is altered, so the failure remains for anyone who has not heard of the workaround, and it returns for everyone on the day the workaround stops working. A workaround is still worth recording on the report. It tells triage how urgent the fix is, since a defect with an easy way round can wait for a scheduled release where one without may not, and it gives support something to tell users in the meantime. A fix is also only one of the possible outcomes for a report. The syllabus describes the defect workflow as deciding on a suitable response, such as to fix the defect or keep it as it is, and its example statuses include deferred and rejected alongside waiting to be fixed. A fix can fail as well. When the retest still reproduces the failure, the report is reopened and the work returns to diagnosis.
Version numbers and change lists treat a bug fix as a category of its own. Semantic Versioning defines a bug fix as "an internal change that fixes incorrect behavior" and reserves the patch number, the 1 in 2.4.1, for releases that contain only backward compatible bug fixes. The Conventional Commits specification gives such a commit the type fix, which it correlates with a patch release, and the Keep a Changelog format lists bug fixes under the heading Fixed. Both spellings are in use. Bug fix, as two words, is the usual form in prose, and bugfix, as one, is common in branch names, ticket types and release notes. Fix, correction and patch are used as synonyms, though a patch also names the update that delivers one or more fixes to installed software, and a hotfix is a fix released outside the normal schedule because the defect cannot wait.
Common questions
What is a bug fix?
A bug fix is a change to the code, or to its configuration, that removes a defect so the software behaves as intended. The term covers the change itself, and in a list of changes it also names the category that corrects existing behaviour, as opposed to a new feature. A fix addresses the cause of a failure, which separates it from a change that only hides the symptom.
Is it bug fix or bugfix?
Both spellings are correct and both are common. Bug fix, as two words, is the usual form in running text, and bugfix, as one word, is common in branch names, ticket types and changelogs. The Conventional Commits specification shortens it further, to the commit type fix. Whichever form a team picks, using one form throughout keeps searches across tickets and release notes reliable.
What is the difference between a bug fix and a hotfix?
A hotfix is a bug fix with a different route to production, and the difference lies in how it is released. A bug fix normally travels with the next scheduled release, after the usual testing. A hotfix is shipped on its own, as soon as it is ready, because the defect is hurting users in production and cannot wait for that release. The hotfix vs bugfix entry covers the trade-off in testing that this speed brings.
How do you fix a bug?
Start with a reproduction that fails every time, stating what to do, what should happen and what happens instead. Narrow it, removing steps and code while checking that it still fails, until the cause is isolated. Then change the code, keep the reproduction as a regression test, and retest the original report. Dan Abramov's essay How to Fix Any Bug sets out the same order and warns against changing code before a reliable repro exists.
What is the difference between a bug fix and a workaround?
A bug fix changes the software so that the defect is gone. A workaround leaves the defect where it is and gives people a way to reach their goal without triggering it, such as another browser or a manual step. The workaround helps today, and only those who know about it, while the fix removes the failure for everyone.
When is a bug fix finished?
A bug fix is finished when the change has been made and reviewed, a test that reproduces the defect passes, the original report has been retested on a build containing the change, the surrounding behaviour has been checked for regressions, and the change is live in a release. Merging the code completes the first of those five and none of the others.
Who should verify a bug fix?
Verification belongs to someone other than the developer who wrote the change. The ISTQB Foundation Level syllabus says confirmation testing is preferably done by the same person who performed the initial test, and that person knows what the failure looked like. Where the report came from a customer, a tester repeats the reported steps and the reporter is told which version carries the fix.
What is the difference between bug fixing and debugging?
Debugging is the search and the cure together, and the fix is its final step. The ISTQB glossary defines debugging as "the process of finding, analyzing and removing the causes of failures in a component or system". Reproducing the failure and diagnosing the defect come first, and the fix is the change that removes the cause once it has been found.
Bug reports that arrive ready to triage.
Collect replay, console, network and browser context with the Free plan.