The Friday fix
On Friday a developer fixes a small bug in the shop app. Only that bug is tested.
On Saturday, the busiest day, customers cannot pay. The fix broke the payment page.
A small change can break an old, working part. How do teams stop this?
Key words
| Word | What it means | Example |
|---|---|---|
| Regression testing | Running old tests again to check a change broke nothing else. | Run all 200 tests |
| Release | Giving the new version to its users. | Version 2.1 reaches the users |
| Planned release | A release on a set date, after the planned work and tests. | Every first Monday |
| Reactive release | An urgent release to deal with a serious problem. | A fix for a security weakness |
| Rollback | Going back to the last good version. | Undo version 2.1 |
| Version number | Numbers that name each release. | 2.4.1 |
| Critical | So important that the product cannot go out without it. | Payment must work |
| Control | Deciding who may release, and when. | The lead developer says yes |
The cells students fill in are left blank in this preview.
Planned releases wait, reactive ones cannot
| Planned release | Reactive release | |
|---|---|---|
| Why | Planned changes are ready | Something is wrong now |
| When | On a set date | As soon as it is safe |
| Tests | The full set of tests | At least the critical tests |
| Example | Version 2.1 with dark mode, every first Monday | A fix for a weak place that attackers use today |
| Risk | Low: there was time to check | Higher: there is less time |
The cells students fill in are left blank in this preview.
Match each word to its story
Have a go
Loading…
Your answers are marked here and are not kept. A college account keeps every student’s marks.
Try it: a fix that breaks something
def price(age):
if age < 5:
return 0
if age < 16:
return 1.0
return 2.5
def run_tests():
assert price(3) == 0, "free test failed"
assert price(10) == 1.0, "child test failed"
assert price(30) == 2.5, "adult test failed"
print("All tests passed")
run_tests()
# A developer wants children under 6 to travel free. On line 2 they mean to change 5 to 6, but they type 60.
# Make that change, then press Run. (< means "is smaller than")
# Read which old test now fails. The free test still passes.
Make a free account to save your work and track your progress.
Run the old tests after every change
After a change, run the old tests again. This is regression testing. A regression is something that used to work and now does not.
The more tests are automatic, the cheaper this is. Teams often run them after every change.
Do not skip tests when in a hurry
Tip
Many people think an urgent fix is too urgent to test. A rushed release with no tests is when new problems appear. In a reactive release, always run at least the critical tests.
Tests and approval control a release
flowchart TD
change[A change is ready] --> kind{Planned or reactive?}
kind -->|planned| full[Run all regression tests]
kind -->|reactive| critical[Run the critical tests]
full --> ok{Pass?}
critical --> ok
ok -->|yes| approve[Release manager approves]
ok -->|no| back[Back to the developer]
approve --> release[Release, and watch the product]
release --> problem{A new problem?}
problem -->|yes| rollback[Rollback to the last good version]
Your turn: the release gate
Your team has a list of test results. Each is a name, True or False for critical, and True or False for passed. can_release gives True or False. A planned release needs every test to pass. A reactive release needs every critical test to pass. must_fix_later gives the names of tests that failed but are not critical. Press Run Tests.
# results is a list of tests. Each one is a tuple: (name, critical, passed).
# critical is True if the product cannot go out with this test failing.
# passed is True if the test passed after the change.
# For one test: test[0] is the name, test[1] is critical, test[2] is passed.
# kind is "planned" or "reactive".
def can_release(results, kind):
# planned release: every test must pass.
# reactive release (an urgent fix): every CRITICAL test must pass.
# other failed tests are allowed, but they must be fixed later.
return False
def must_fix_later(results):
# The names of the tests that failed and are not critical. Keep the order.
return []
Make a free account to save your work, or press Start lab to work through the whole lesson.
Number the version
Version numbers have three parts: major, minor and patch. A bug fix raises the patch. A new feature raises the minor and sets the patch to 0. A big change raises the major and sets the rest to 0. Fill in next_version. Press Run Tests.
# A version number has three parts: major.minor.patch, for example "2.4.1".
# a big change that may break old things: major goes up by 1, minor and patch go to 0
# a new feature: minor goes up by 1, patch goes to 0
# a bug fix: patch goes up by 1
# kind is the text "major", "minor" or "patch".
def next_version(current, kind):
# Hint: "2.4.1".split(".") gives ["2", "4", "1"]. int("4") is 4.
return ""
Make a free account to save your work, or press Start lab to work through the whole lesson.
Check: releases and versions
Have a go
Check: releases and versions
4 questionsKey words crossword
Have a go
Loading…
Your answers are marked here and are not kept. A college account keeps every student’s marks.
Final check
Have a go