Skip to content

On the difficulty of reproducing a defect #446

Description

@ploeh

Given the defect identified in the discussion of #441, I wanted to reproduce the bug as an automated test (one for each instance of the problem, in fact).

This has turned out to be surprisingly difficult.

First I tried with fully-defined FsCheck generators, but even though I had help from Copilot, this quickly blew up due to the deeply nested structure of the data types. To show the results of this attempt, I've pushed a branch called gen-for-order-plan. The test fails, as it should, but it also fails when you apply a fix.

The problem is that getting to a non-empty OrderPlan.Totals value requires, it seems, a very particular combination of input values, and it's not clear to me what such a combination might look like. I've found no tests to guide me in that direction, either.

After some time, I put the gen-for-order-plan branch on hold in order to start with a more focused approach. This, then, has met with the same problem. I've pushed that attempt to a branch named update-order-plan-test-attempt. Here, I've instead tried to use FsCheck to run through possible values and filter out those that produce empty Totals values, so far with the outcome that the test hangs, since the generators never arrive at a 'winning combination'.

Since I have access to all the source code, I can, of course, given enough time, reverse-engineer the implementation of OrderPlanService.calculateTotals, but so far, I've already spent more hours on this problem than I would have expected.

And since I'm on the clock, I only find it mature and responsible to stop and ask: Am I missing something obvious, or is it really that hard, given that I have no domain knowledge to draw on?

Please advice on how I should continue.

Metadata

Metadata

Assignees

Labels

questionFurther information is requestedtestingRelated to test coverage, test failures, or test tooling

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions