Phase 1 Complete · Open Source · Apache 2.0

The Missing Dimension
in Java Test Quality

JaCoCo tells you which lines ran. SonarQube checks your branches. PIT tests your assertions. But what tells you if you actually tested the right combinations of real-world scenarios? ScenarioLens does. Stop guessing if your mocks cover what really happens in production.

Get Started Fast Star on GitHub View Sample Report →
JaCoCo/ Did this code run?
SonarQube/ Did branches execute?
PIT/ Are assertions strong?
ScenarioLens/ Are the right scenarios tested?

100% Branch Coverage.
Still Shipping Critical Bugs.

As senior engineers, we've all been there. Your PR has perfect coverage. The CI pipeline is glowing green. Then production falls over because a downstream payment service returned an unexpected null while your database transaction was quietly rolling back.

A test suite can easily achieve 100% branch coverage while missing entire combinations of dependency behaviors. Until now, none of your existing tools could warn you about the scenarios you forgot to mock.

5,229
Methods analyzed across 5 massive codebases
99.97%
Noise reduction (max pruning ratio on Spring PetClinic)
0
Crashes across Kafka, Spring, and Baeldung audits
<750ms
Analysis time per package

Pure Static Analysis.
Zero Runtime Overhead.

We know how painful slow test suites are. That's why ScenarioLens doesn't spin up your Spring context, instrument your bytecode, or run a single test. It analyzes your source code at rest.

1

Parse Method AST

JavaParser + JavaSymbolSolver builds a full typed AST of the method under test.

MethodParser
2

Detect Outgoing Calls

Identifies all injected dependencies — Spring Data repos, Feign clients, KafkaTemplate, event publishers.

OutgoingCallDetector
3

Build Control Flow Graph

AST-driven CFG with if/else, try/catch, switch, and nested condition edges — no bytecode required.

CfgBuilder
4

Enumerate Return Variations

Generates stub variations per call: enum constants, null returns, boolean outcomes, exception paths, void presence/absence.

ReturnVariationEnumerator
5

Prune Impossible Combinations

Three-rule CFG pruning eliminates scenarios that cannot coexist on any execution path. Up to 99.97% pruning on real codebases.

PathPruner
6

Extract Existing Mockito Stubs

Parses when/thenReturn, when/thenThrow, doReturn from test classes including @BeforeEach setup merging.

MockitoStubExtractor
7

Report Gaps with Risk Weighting

Matches pruned scenario matrix against existing tests. Gaps are classified AUTO-VALIDATED, BOUNDARY, or INFO with actionable recommendations.

GapAnalyzer

Your Tools Have a Blind Spot.

Your existing tools are fantastic at what they do, but they have a blind spot when it comes to complex dependency interactions. ScenarioLens is designed to sit right alongside them to complete the picture.

Gap Type JaCoCo SonarQube PIT ScenarioLens
Missing scenario combinations
Enum value coverage gaps
Null return from dependency untested
Specific stub combinations missing
Weak assertions (assertNotNull)
Untested branches

A Three-Tier Gap Report

We hate noisy tools as much as you do. Every coverage gap ScenarioLens finds is strictly categorized by how confidently the tool can verify it, so you know exactly what to fix first.

ScenarioLens HTML Report from PaymentService Example

Authentic gap analysis report generated from the PaymentService example repository.

AUTO-VALIDATED

Tool-verified gaps

ScenarioLens fully verifies presence and correctness. Missing scenarios fail the build at your configured threshold.

BOUNDARY

Boundary scenarios

Tool generates the scenario, developer confirms the stub values. Useful for config-driven thresholds and numeric boundaries.

INFO

Advisory items

Tool cannot validate statically. Surfaced for manual or LLM review. Never fails the build.

Up and Running in Minutes

Drop the Maven plugin into your project, point it at your target package, and get a comprehensive gap report instantly.

pom.xml
<plugin>
  <groupId>io.scenariolens</groupId>
  <artifactId>scenariolens-maven-plugin</artifactId>
  <version>0.1.0</version>
  <configuration>
    <targetPackage>com.example.payment</targetPackage>
    <minScenarioCoverage>70</minScenarioCoverage>
    <maxScenariosPerMethod>500</maxScenariosPerMethod>
  </configuration>
</plugin>
terminal
# Clone and install
git clone https://github.com/scenariolens/scenariolens.git
cd scenariolens && mvn install -DskipTests -q

# Run against the example payment service
cd examples/payment-service
mvn scenariolens:analyze -DtargetPackage=com.example.payment

# Output
[INFO] Methods analyzed: 22
[INFO] Total scenarios:  84
[WARN] AUTO-VALIDATED MISSING — order status CANCELLED
[INFO] Report: target/scenariolens/report.html

Give Your AI Agents a Map.

General-purpose AI coding agents are great, but they struggle to know what tests to write. ScenarioLens generates a structured JSON report designed specifically for LLM consumption.

AGENT INSTRUCTION

Run the ScenarioLens Maven plugin which generates a coverage gap analysis report at target/scenariolens/report.json. Review the report and generate missing tests. Repeat until DSC score is above 80%.

It works today. No API keys, no proprietary provider lock-in, and zero integration work required.

Claude Gemini GitHub Copilot GPT-4 Any shell-capable agent

Where We're Heading

Phase 1 is battle-tested and ready. Here is what we're building next to make ScenarioLens even more powerful:

Phase 2
Hybrid Boundary Resolution — Resolving dynamic boundary values via @Value properties parsing without needing test execution.
Planned
Phase 3
Ecosystem Expansion — SonarQube XML and LCOV tracefiles (Shipped!), Native Gradle plugin, WireMock stub extraction, and @MockBean support.
In Progress
Phase 4
Advanced Analysis — Multi-method flow tracing, intelligent numeric boundary inference, and assertion causal correctness hints.
Planned

View full ROADMAP.md →

Stop Guessing. Start Knowing.

Join the engineers shipping resilient code with Dependency Scenario Coverage.