Skip to content

C# conformance suite: remove the 239 test methods that detect nothing of their own - #133

Merged
miho merged 1 commit into
mainfrom
test/trim-csharp-suite
Nov 28, 2026
Merged

miho merged 1 commit into
mainfrom
test/trim-csharp-suite

Conversation

@miho

@miho miho commented Nov 28, 2026

Copy link
Copy Markdown
Owner

The C# conformance suite had 1280 cases in 866 test methods, written feature by feature while C# was compared with Java, and many of them repeat each other. This removes the 239 methods (283 cases) that detect nothing which the remaining tests and the portable scenarios do not detect as well. 997 cases in 627 methods stay.

What stayed

Reason Methods
Exchanges documents with the Java programs, or reads a shared expectation in fixtures/ 268
Written together with a runtime change, to pin it 14
Guards against what a seeded fault cannot show: recursion as deep as a limit allows, the largest sequence numbers, concurrent use 6
Needed so that the rest still detects, reaches and runs what the full suite did (below) 339

The last group is a smallest-set choice over three measurements of the full suite:

  • Seeded faults. Mutation testing (Stryker.NET 5.1) changed the runtime in 9,521 places, one at a time. The full suite and the portable scenarios noticed 6,799 of the changes; the kept tests have to notice each of them. What the scenarios notice by themselves (1,717) needs no C# test, since they run in the same gate.
  • Reached places. Every runtime line the full suite ran, and every expression or statement that mutation testing changed and a test reached, is still reached.
  • Generated code. Every shape of generated model code that a test ran is still run: 2,304 lines of generated code after replacing the names of the model by placeholders.

Evidence

  • The mutation run was repeated with the kept tests. They noticed 6,793 of the 6,799 changes again. None of the six others went with a removed test: the tests that had noticed five of them are kept, and they notice these changes only in some runs of the instrumented runtime (with the change made by hand in the normal runtime, they pass); the sixth was a timeout of the first run whose only test is kept too. The four faults that the first reduced suite had let through are noticed again.

  • Runtime line coverage of suite and scenarios together is unchanged: 8,958 of 9,415 coverable lines.

  • :vmf:verifyCSharpConformance passes with 997 cases; all 49 Java programs that read documents written by C# pass.

  • No fixture lost its C# reader, and no model set lost all of its tests.

What it does not change

The gate takes as long as before: its time is code generation and compilation of the 36 model sets in two languages, and none of them could go.

Cases per area

Area Cases before Cases now
Containment, opposites, references 169 147
Scalars and scalar lists 23 22
Events 92 70
Listener order and reentrancy 69 43
History 4 4
Views and immutables 42 30
Equality and copies 25 13
Reflection 14 8
JSON documents 31 31
XML and YAML 68 66
Journals, patches, diff, merge, versions 147 117
Validation and schema 62 47
Keyed containment, maps, sets 62 50
Behavior delegation and roles 35 27
Defaults beyond literals 114 79
Builders and apply 55 32
Cursors and traversal 34 21
External types, enums, codecs 54 48
Generics, redeclaration, covariance 93 79
Real-model ports 37 34
Feature bundles 14 12
List operations beyond the contract 12 10
Summaries and toString 5 4
C# platform integration 5 3
Total 1266 997

"Before" is the count on main before #132, which added 14 cases (containment 7, events 6, reflection 1).

How the selection was corrected on the way

A first selection, by seeded faults, lines and shapes alone, kept 579 methods. Three things it could not see were added before anything was merged:

  • 32 of the tests it dropped read expectation files shared with Java, and two of those files would have lost their only C# reader.
  • A test that detects a fault by never finishing is not named by the mutation tool. A confirming run with the reduced suite showed four such faults surviving; the two tests that guard against them are back, with four more of the same kind (depth limits, the largest sequence numbers).
  • A line can be reached while one of its branches is not. Five error branches were no longer run; the rule about reached places now covers them.

Limits

A removed test may have checked something that no seeded fault resembles and no line, branch or shape tells apart. About 2,160 seeded changes could not be tried because the changed code does not compile (among them everything in ContainmentList.ReplaceRange); there the line and branch rules are the only measure. The selection tooling is not part of the repository.

…eir own

The suite had 1280 cases in 866 methods, written feature by feature while
C# was compared with Java. Many repeat each other: 130 of the 215 classes
covered no runtime line that another class did not cover. This removes the
methods (283 cases) that the remaining tests and the portable scenarios
make superfluous, and keeps 997 cases in 627 methods.

A test stayed if

- it exchanges documents with the Java programs or reads a shared
  expectation in fixtures/ (268 methods): the gate checks every such file
  in both languages as before;
- it was written together with a runtime change (14 methods);
- it guards against what a seeded fault cannot show: recursion as deep as
  a limit allows, the largest sequence numbers, concurrent use (6);
- or the others needed it (339 methods) to still notice every fault that
  the full suite noticed, reach every place of the runtime it reached,
  and run every shape of generated code it ran.

Faults are from mutation testing with Stryker.NET 5.1: 9,521 single
changes of the runtime, of which the full suite and the portable
scenarios noticed 6,799. A repeat with the kept tests noticed 6,793 of
them again; the tests that had noticed the six others are among the kept
ones, and their result varies between runs of the instrumented runtime.

No model set lost all of its tests, so the gate generates and compiles
what it did before and takes as long. TEST-AREAS.md has the new counts
per area and describes the rules; the README says that not every
sentence of its list has a C# test of its own any more.

ReferenceDefaultBindings.DuplicateSeed was only set by a removed test.
@miho
miho merged commit b7deb85 into main Nov 28, 2026
14 checks passed
@miho
miho deleted the test/trim-csharp-suite branch November 28, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant