October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk7 min

Mutation Testing: How My Test-Fixing Agent Exposed Eight Harness Bugs

An agent built to improve weak tests revealed eight defects in the harness measuring its results. The case shows why mutation testing, reproducibility, and bias checks matter.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Marvin Okafor built an agent to generate tests for surviving code mutations—and found that eight defects in his evaluation harness could make its results look better, cleaner, or more convincing than they were. His account is a useful case study in a difficult engineering truth: an agent’s score is only as trustworthy as the instrument that measures it.

Okafor describes a project-specific experiment, not a general benchmark. The agent tried to strengthen test suites by targeting surviving mutants, while the harness decided whether its generated tests deserved to be kept. When the harness itself was wrong, it risked turning a measurement into a misleading result.

As an Amazon Associate I earn from qualifying purchases.

The account comes from Okafor’s article on DEV Community. The repository was described as private, so the code and reported results have not been independently reproduced here.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What mutation testing measures—and what coverage does not

Mutation testing makes small, deliberate changes to code and runs the test suite against each changed version. A mutant is “killed” when tests fail; it “survives” when they do not. A surviving mutant is evidence that the tested suite did not detect that particular change. It is not, by itself, proof that the original program has a production defect.

Line coverage answers a different question: did a test execute this line? Execution does not establish that the test would notice an incorrect result. A test can pass through a line while making no assertion about the behavior that line controls. Mutation testing probes whether the suite responds to selected changes, making it a fault-detection signal rather than a substitute for judgment about test quality.

Okafor’s framing is direct: “If no test fails, that is a bug your suite cannot detect.” In context, the statement is about the tested suite’s ability to detect a change—not a claim that every surviving mutant corresponds to a real-world bug.

How the agent tried to improve weak tests

The agent identified a surviving mutant, supplied a model with the mutation diff, and asked it to create a test. A generated test was accepted only if it passed against clean code and failed against the targeted mutant. On a retry, the agent could provide actual pytest output. The acceptance decision came from the subprocess exit code, rather than asking the model to judge whether its own test worked.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

That two-sided gate matters:

  • Passes on clean code: the test does not simply fail against the unmodified program.
  • Fails on the mutant: the test detects the specific change it was intended to catch.

A test that only satisfies the first condition may be valid but ineffective. One that fails on both clean and mutated code may be broken. Checking both outcomes separates a plausible test from one that actually detects its target mutation.

Eight defects that undermined the measurement

Okafor reports finding eight harness defects. He says each would have made results look better, cleaner, or more publishable. That direction-of-bias assessment is his account; without the private code, it cannot be independently audited.

  1. Mutations were written to a temporary copy, but imports came from the checkout. Editable installs for packages using a src layout resolved imports to the original code instead of the mutated copy. The mutations were therefore invisible, and three targets appeared to score 0.000.
  2. Parallel execution made one target unstable. Running mutants concurrently produced three different survivor sets across four runs for a target using asynchronous I/O.
  3. The test-file picker selected the wrong file. On the hardest target, the harness ran a test file that was not the intended one.
  4. A batch-level classifier blurred individual test results. It classified batches rather than tests, allowing one strong test to make a whole batch of 69 appear strong.
  5. Test reconstruction dropped shared imports. Rebuilding a generated test without its shared imports manufactured failures that did not reflect the test’s intended behavior.
  6. The extractor missed valid test methods. It scanned only top-level functions, discarding valid unittest.TestCase responses. The retry loop then received a harness error instead of pytest output.
  7. An assertion was mistaken for no assertion. The classifier treated self.assertEqual(...) as “no assertion,” potentially creating the very outcome the author had hypothesized.
  8. A metric was applied where it was undefined. A pre-registered metric did not apply to dunder-dispatched code such as __call__ and __or__, yet appeared as a real, near-zero rate.

How Okafor checked whether the instrument was lying

Rather than relying only on code review, Okafor says he predicted what specific checks should report and then investigated when their outcomes were wrong. He summarized the approach this way: “None of them was found by reading code.” He says each defect surfaced when he anticipated a check’s result and found that the actual result contradicted the prediction.

That method makes the expected outcome part of the test. If a mutant is supposed to be imported from a temporary directory, check where the running process imports it from. If a classifier is meant to score tests individually, give it a batch where one test is strong and the rest are not. If a metric is supposed to apply only to certain dispatch patterns, verify that unsupported cases are marked as inapplicable rather than given a plausible-looking number.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Okafor’s key question for measurement design was: “What would my instrument look like if it were lying to me?” A practical extension is to write down not only the expected result, but also how a failure could bias the score. That makes it easier to spot errors that produce tidy, favorable numbers instead of obvious crashes.

What the reported numbers do—and do not—show

Okafor reports that the project examined 455 mutants across 12 Python libraries, with 133 surviving the existing test suites. He says 53 of the 133 survivors were on lines the tests had executed. After he widened per-target test commands by between 6 and 40 times, the reported count changed from 54 to 53, while previously unreachable mutations instead became kills. These are figures from his project, not independently validated measurements or industry benchmarks.

In a comparison covering 15 mutants, the single-test baseline reportedly killed 1, while the agent killed 9; the reported keep rate was 60%. The author says the run covered only two of ten targets before the API budget ran out, and those were the targets where the baseline performed worst. This was not a random or representative sample.

Other details further narrow what can be concluded:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Okafor reports that all nine kills came from the two cheapest mutation types.
  • He reports no cross-function transfer, and says seven kept tests killed only the mutation they targeted.
  • He expected accepted tests might often be vacuous. Instead, he reports an empty “none” category, eight of nine kills as real assertion failures, and six discarded drafts that passed on clean code but did not detect the mutation. In this small run, the gate appears to have filtered valid but ineffective drafts, rather than merely rejecting broken tests.

These results suggest the agent could generate tests that detected targeted changes in some cases. They do not establish how it would perform across targets selected in advance, more mutation types, or broader testing conditions. The sample was small, selectively reached, and concentrated in two inexpensive mutation types.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Reproducibility is part of the result

For a clean-clone check, Okafor says he ran each target three times serially and required byte-identical survivor sets. Eleven of the twelve targets reportedly reproduced the same sets; one varied, and that result was disclosed in the README. This is the author’s reported protocol and outcome, not an independent reproduction.

That check speaks to repeatability under those conditions, not to whether the chosen mutants or tests adequately represent software quality. The asynchronous-I/O target’s earlier variation under parallel execution also shows why the execution mode is not a minor implementation detail: changing it changed the observed survivor sets.

What to carry into another agent evaluation

Okafor’s experience supports a practical discipline for teams evaluating test-generation systems:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Define the outcome before running the agent. Specify what counts as a valid test, a detected mutation, a discarded draft, and an inapplicable metric.
  2. Test the evaluation pipeline with controlled cases. Verify import paths, mutation visibility, test selection, reconstruction, extraction, assertion recognition, and metric handling separately.
  3. Predict outcomes in advance. For each check, record what should happen and how an incorrect result could bias the reported score.
  4. Compare clean and mutated code. Require a candidate test to pass on the clean program and fail on the targeted mutant; use the test runner’s result as the acceptance signal.
  5. Control and disclose execution conditions. If concurrency can affect results, compare serial and parallel runs and state which results are reproducible.
  6. Report the selection process and limits. State which targets and mutation types were covered, what was not reached, and whether targets were chosen through a representative plan.

The broader lesson is methodological, not a claim that this agent—or any other—has demonstrated general superiority. Evaluation infrastructure is part of the experiment. A convincing number can still be wrong if the harness imports the wrong code, runs the wrong tests, misreads assertions, or reports an undefined metric as a real score.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.