Skip to Main Content
Talk Intermediate Slides and talk materials: CC BY 4.0. Demo test code: MIT.

Bugs That Don't Come Back: From Bug Report to Regression Test in FOSS

Proposal status is Review Pending
Session Description

A failing test is supposed to tell you what went wrong. In one real pytest bug, it didn't.

Compare {"a": 1, "c": 5} with pytest.approx({"c": 3, "a": 1}) and the test fails, as it should. But before the fix was released, the failure report said both values were wrong, even listing "a" (1 vs 1) as a mismatch. The cause was one loop that paired values by position instead of by key, so dictionaries with the same keys in a different order produced misleading failure reports.

The reporter had already isolated it well: the same mismatch with the keys in the same order produced a correct report. Only the order changed.

I checked out the commit immediately before the fix and tried writing the regression test myself. Three of my first four tests passed against the buggy code: checking equality, checking that an AssertionError was raised, and even checking that the report mentioned "c". Only a test that checked the mismatch count caught the defect.

Then I compared my tests with the two regression tests the maintainers merged. One exposes the bug. The other also passes against the buggy code: it checks that dictionaries with matching values still pass, protecting existing behaviour from being broken by the fix. Not every regression test needs to fail before a fix, and knowing which kind you are writing matters.

In this talk, I will walk through the bug report, the reproduction, the root cause, and both kinds of regression test, live.

Key Takeaways

By the end of this session, you will understand:

  • A good bug report isolates the problem with evidence, and validating it comes before writing any test.

  • A regression test is only proven once you have seen it fail on the buggy code.

  • When the bug is in a report or message, assert on the report itself, not just on pass or fail.

  • Some regression tests are meant to pass before the fix: they protect existing behaviour. Know which kind you're writing.

  • How to turn an existing open-source issue into a meaningful contribution without building a new feature.

References

Session Categories

Engineering practice - productivity, debugging
Talk License: Slides and talk materials: CC BY 4.0. Demo test code: MIT.

Speakers

Ujjwal Kumar Singh
Ujjwal Kumar Singh SDET | Skeps

Ujjwal Kumar Singh is a Software Development Engineer in Test (SDET) with over 4+ years of experience in software testing and test automation, mainly in the FinTech domain.

His work and learning focus on understanding how software behaves in real-world situations and finding ways to improve testing practices. His areas of interest include Python-based test automation, exploratory testing, property-based testing, AI in software testing, and open-source software.

He is a Ministry of Testing Ambassador and actively contributes to the testing community through knowledge-sharing sessions, community events, and open-source initiatives. He has spoken at various meetups and tech events, sharing his experiences, experiments, and practical approaches to software testing.

He believes testing goes beyond finding bugs and writing automated test cases. It involves asking the right questions, challenging assumptions, and understanding how software can fail.

Through his talks and community contributions, he wants to share what he learns, encourage critical thinking, and help other testers explore different aspects of software testing.

Reviews

No reviews yet.