oliverdavies.uk/source/_daily_emails/2023-09-18.md

28 lines
1,001 B
Markdown
Raw Permalink Normal View History

2024-01-03 20:00:00 +00:00
---
title: >
2024-09-08 22:09:54 +00:00
Increasing test coverage with regression tests
2024-01-03 20:00:00 +00:00
pubDate: 2023-09-18
permalink: >-
daily/2023/09/18/increasing-test-coverage-with-regression-tests
2024-01-03 20:00:00 +00:00
tags:
2024-09-08 22:09:54 +00:00
- software-development
- automated-testing
- test-driven-development
2024-01-03 20:00:00 +00:00
---
Automated test suites don't tell you everything works - they tell you what you've tested isn't broken.
Having tests doesn't mean your code is bug-free. There could be edge cases or scenarios you haven't tested for that contain bugs, even though your test suite is passing.
## What do we do?
When you find a bug, try replicating it within an automated test before attempting to fix it.
Once you have a failing test and can replicate the issue, go ahead and fix it.
If the test passes, you know you've fixed the bug and solved the issue.
## Here's the thing
Now you have this test, you cannot re-add the bug again without the test failing. You've prevented anyone from accidentally re-introducing it in the future and increased your test coverage.