Skip to content

QA-CS-103 — Test without assertions ​

← Back to the rule catalog

Generated from the rule registry. Get the same detail from the CLI with mjolnir explain QA-CS-103.

FieldValue
Severityerror
Confidencehigh
Tierextended
Measured FP rate0% (n=11)
Evidence levelE2
QA impactFalse-green risk (FALSE-GREEN)
False-positive risk (author estimate)low
Autofix availableno
Languagescsharp
Frameworksnunit, xunit, mstest
Detection strategyAST (L2 tree-sitter test-method scoping + structural assertion oracle (Shouldly/Verify/Assert receivers, throwing waits); regex fallback when no parse)
Introduced inv0.3.8

Why this fails in production ​

A C# test with no Assert.*/FluentAssertions-style assertion (NUnit and xUnit both follow the same throw-to-fail model as JUnit and pytest) passes for the same underlying reason as every other assertion-less rule in this catalog: nothing threw, so nothing failed, regardless of what the test actually exercised. Kept as a distinct rule from QA-TEST-003/QA-PY-003 because .NET Playwright is async-only (GotoAsync, ClickAsync) — the fixture shapes that trigger this rule look meaningfully different in C# even though the underlying defect is identical.

What gets flagged (real detector output) ​

Test `ShouldCompleteCheckout` contains no assertions.

Example from this rule's own must-fire fixture: tests/fixtures/QA-CS-103/must-fire/CheckoutTests.cs

The fix ​

Add an assertion on the expected outcome, or remove the test.

Confirmed NOT to fire on the corresponding clean pattern ​

Verified against tests/fixtures/QA-CS-103/must-not-fire/CheckoutTests.cs — a legitimate, similar-looking pattern this rule correctly leaves alone.

Corpus-measured false-positive risk ​

Real occurrence counts from npm run corpus:audit against actively-maintained OSS repos — reproduce yourself, don't just trust this table (see the false-positive audit):

RepoOccurrences
Humanizr-Humanizer2
microsoft-playwright-dotnet1
positive-fixtures8
SeleniumHQ-selenium102

Released under the MIT License.