Writing Test Cases for Bug¶
A bug fix is incomplete without proof that the root cause is understood and cannot silently return. Your task is to turn an existing bug report into a reproducible regression test.
Your Task¶
- Select: Pick one reproducible bug issue from your project repository.
- Document or Automate: Write a manual test case (
docs/testing/test_cases/tc_bug_<id>.md) or implement an automated unit test (pytest/JUnit). - Prove Failure: Run the test against the buggy version; it must explicitly fail (
FAIL). - Link: Cross-link the test in the GitLab bug issue and reference it in
README.md.
The goal is not to assert that the feature works in general, but to capture the exact reported failure. If the test passes on the buggy codebase, it does not represent the regression.
Misleading Test vs. True Regression Test¶
- Symptom: Submitting a duplicate project name causes the modal to close silently with no error message.
- Flawed Test:
assert count_projects_named("demo") == 1— this passes even on the buggy build because it misses the silent UI feedback failure. - Valid Test: Asserts that the validation contract was met:
assert result.error_code == "PROJECT_NAME_ALREADY_EXISTS".
Regression Test Case¶
1 2 3 4 5 6 7 8 | |