Skip to content

QA-JV-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-JV-103.

FieldValue
Severityerror
Confidencehigh
Tierextended
Measured FP rate26% (n=58)
Evidence levelE2
QA impactFalse-green risk (FALSE-GREEN)
False-positive risk (author estimate)medium
Autofix availableno
Languagesjava
Frameworksjunit, testng
Detection strategyAST (L2 tree-sitter test-method scoping + structural assertion oracle (throwing waits, helper idioms); regex fallback when no parse)
Introduced inv0.3.8

Why this fails in production ​

A JUnit/TestNG test method with no assertEquals/assertTrue/ AssertJ-style assertion (and no exception expected via @Test(expected = ...) or equivalent) reports green for the same structural reason as every other language's assertion-less test: the runner only fails a test when something throws, and this test throws nothing. Java suites often obscure this further with helper methods and page-object indirection, which makes an assertion-less test method read as more thorough than it is on a quick review.

What gets flagged (real detector output) ​

Test `shouldCompleteCheckout` contains no assertions.

Example from this rule's own must-fire fixture: tests/fixtures/QA-JV-103/must-fire/CheckoutTest.java

The fix ​

Add an assertion on the expected outcome (assertEquals, assertThat(locator).isVisible()), or remove the test.

Confirmed NOT to fire on the corresponding clean pattern ​

Verified against tests/fixtures/QA-JV-103/must-not-fire/CheckoutTest.java — 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
appsmithorg-appsmith80
iluwatar-java-design-patterns41
junit-team-junit5833
keycloak-keycloak1390
microsoft-playwright-java43
positive-fixtures5
SeleniumHQ-selenium249

Released under the MIT License.