Black Friday sale: an extra 40% off every course until Monday, November 30.New Year sale: an extra 30% off every course until Friday, January 1.Memorial Day sale: an extra 25% off every course until Monday, May 31.SysAdmin Day sale: an extra 25% off every course until Sunday, August 1.Back to School sale: an extra 25% off every course until Sunday, August 22.Labor Day sale: an extra 25% off every course until Monday, September 6.Black Friday sale: an extra 40% off every course until Monday, November 29.New Year sale: an extra 30% off every course until Saturday, January 1.Choose your certification →

Copyright (c) 2026 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.

9.2.2. Misuse Case Testing and Coverage Analysis

💡 First Principle: Scanners test what code does wrong in general; misuse cases test what this application must never allow; coverage analysis tells you how much of the code and the requirements your tests actually exercised. The first two find flaws, the third measures the evidence behind "we tested it". The reusable questions: which abuses of this business process would hurt most, is there a test that attempts each one, and which code did no test ever run?

Misuse-case testing for business logic: business-logic flaws (negative quantities, skipped workflow steps, a discount applied twice, price or quantity tampering, reading another customer's record by changing an ID) match no SAST pattern, no SCA advisory and no scanner signature, and an unauthenticated scan never reaches the workflow. They are found by authenticated dynamic or manual tests built from misuse cases, the abuse cases written during requirements (9.1.1). Each misuse case becomes a negative test: perform the steps out of order, replay a request, submit a value the interface would never send, run two requests at once, act as a different user. The expected result is a refusal, and the test passes only if the refusal happens on the server. Once written, the test joins the automated regression suite so a later change cannot quietly reopen the flaw.

Coverage analysis: coverage is measured by instrumenting the code and recording what executes while the tests run. The common measures, from weakest to strongest:

MeasureQuestion it answersGap it leaves
Function coverageWas every function called at least once?Says nothing about what happens inside it
Statement (line) coverageDid every statement execute?An if with no else can be fully covered without ever testing the false case
Branch (decision) coverageDid every decision take both its true and false outcome?A compound condition can pass without each part being tested
Condition coverageDid each individual condition evaluate both true and false?Does not show each condition affecting the outcome
Loop coverageDid each loop run zero, one and many times?Boundary values inside the loop
Path coverageDid every route through the code execute?Rarely achievable: loops and branches multiply the paths

Safety-critical software pushes further: DO-178C requires modified condition/decision coverage (MC/DC), showing that each condition independently affects the decision, for the most critical level of airborne software. Coverage can also be measured against requirements rather than code: the share of use cases and misuse cases that have at least one test (tested cases divided by total cases), tracked in a traceability matrix.

Reading coverage as a manager: coverage shows what ran, not what was checked. A test with no meaningful assertion still produces coverage, and 100% line coverage of an authorization function proves nothing if no test ever called it as the wrong user. Use coverage to find the untested code, especially security-critical paths such as authorization checks, input parsing and error handlers, and set targets per component rather than one number for the whole codebase. Coverage-guided fuzzers use the same instrumentation to steer their inputs toward code not yet reached.

⚠️ Exam Trap: "The application has 95% code coverage, so it has been thoroughly tested." Coverage measures execution, not correctness or security. Statement coverage can be complete while every false branch, every error path and every misuse case goes untested. When asked how to judge test adequacy, prefer stronger measures (branch or condition coverage), coverage of security-critical code, and requirements coverage that includes misuse cases.

Reflection Question: An online retailer's checkout passes SAST, DAST and SCA with no high findings and reports 88% line coverage. A customer discovers that applying a coupon, removing the item and adding it back applies the discount twice. Why did none of the tools or the coverage figure reveal this, which misuse cases would you add to the test suite, and which coverage measure would you ask for on the pricing and authorization code?

See how it connects
Alvin Varughese
Written byAlvin Varughese
Founder•26 professional certifications earned