1 / 10
GAMIST

Automating Test Model Generation
from BDD Scenarios
with AI-Assisted Coverage Improvement

A unified framework bridging Behavior-Driven Development & Model-Based Testing through PAP synthesis and LLM-driven coverage gap detection

Kavita A. Jadhav
K11 Software Solutions LLC  ·  Texas, USA  ·  2026
BDD MBT GraphWalker LLM Java 17
The Challenge

Two Powerful Approaches.
Never Integrated.

BDD
✅ Human-readable Gherkin scenarios
✅ Collaborative: devs, testers, POs
❌ No formal model for path generation
❌ Manual scenario drift over time
VS
MBT
✅ Formal directed graph model
✅ Systematic path coverage strategies
❌ Manual model authoring — costly
❌ Disconnected from BDD scenarios
🔗   The gap: both artefacts maintained separately, in different notations, by different roles — drifting out of sync over time
Our Solution

Three Concrete Contributions

🧬
Contribution 1

PAP Synthesis Algorithm

Automatically derives a GraphWalker-compatible state-machine model from any Gherkin corpus. Zero manual model authoring.

Given → Source vertex
When → Edge(s)
Then → Target vertex
📊
Contribution 2

Empirical Evaluation

37 production scenarios, 4 feature files, 4 quantitative metrics: SSRR, ERR, MC, GIA — on a live Next.js web application.

SSRR=0.54 · ERR=0.08
MC=65% · GIA=100%
🤖
Contribution 3

AI Coverage Gap Detection

LLM analyzes the synthesized model and execution history to propose missing transitions as structured EdgeProposal records.

MbtCoverageAdvisor
CoverageGapLoop
Contribution 1

The PAP Synthesis Algorithm

Input
GIVEN
Last Given step
→ Source vertex
most specific precondition
→
Action
WHEN
Sequential actions
→ Edge chain
guard on first edge
→
Outcome
THEN
First Then step
→ Target vertex
primary observable state
→
Output
JSON
GraphWalker model
+ traceability
report
Guard sourceExample tag/patternInferred guard
Cucumber tag@requires-accountisLoggedIn
Cucumber tag@live-writecanWrite
Negative-path detectioninvalid / fail / error in title!isValid
37 scenarios → 20 vertices · 25 edges · 10 guards  |  100% guard inference accuracy
Step Normalizer

4-Stage Normalization Pipeline

1
Parameter
Erasure
Replace Cucumber expression params & quoted literals with _X_
›
2
Regex Pattern
Matching
Ordered regex → label rules. First match wins. Vertex vs edge rules.
›
3
Stop-word
Fallback
Strip stop words · take up to 6 tokens · convert to PascalCase / camelCase
›
4
ID
Construction
Vertices: v_ prefix
Edges: e_ prefix
GIVEN: "I am on the K11 login page" → v_K11LoginPage
WHEN: "I login with email _X_ and password _X_" → e_loginWithCredentials
THEN: "I am logged in successfully" → v_LoggedIn
Framework Architecture

BDD-to-MBT End-to-End Data Flow

Framework Architecture Diagram

Gherkin .feature files → PAP Parser → BddToMbtSynthesizer → GraphWalker JSON model → AI coverage loop (MbtCoverageAdvisor + EdgeProposal) → Step Def Generator → BDD Runner → Test Reports

Framework Ecosystem

9 Framework Modules — One Cohesive Engine

⚙️
framework-core
BDD/MBT engine, driver managers, CommandFactory mandatory
🗄️
framework-data
DB/TestContainers, Faker, PII masking
🤖
framework-ai
Ollama/OpenAI/Claude, MbtCoverageAdvisor
📋
framework-reporting
Allure, Slack/Teams webhooks
🔐
framework-security
OWASP ZAP, JWT, injection payloads
👁️
framework-visual
Pixel diff, baseline management
⚡
framework-performance
SLA assertions, Micrometer timing
🔗
framework-microservice
Pact, WireMock, contract testing
📱
framework-device
ADB, simctl, BrowserStack, Sauce Labs
Evaluation Domains & Dataset
🌐
domain-k11 ★ Evaluated
37 BDD scenarios · 4 feature files · live Next.js app
Synthesized model · SSRR=0.54 · GIA=100%
📈
domain-trading Baseline
TradingWorkflow.json — expert hand-crafted model
7 vertices · 11 edges · comparison baseline
🛒
domain-ecommerce Future
E-commerce feature files & step definitions
Planned for multi-domain synthesis evaluation
Empirical Evaluation

Results on domain-k11 — 37 Scenarios, 4 Feature Files

M1
0.00
State Space Reduction Ratio
37 scenarios compressed to 20 vertices — 46% state compression proves genuine sharing
M2
0.00
Edge Reuse Ratio
2 of 25 edges shared across multiple scenarios. Low — expected for single-domain corpus
M3
0
Model Completeness
24 of 37 scenarios contributed edges. Remaining 35% contribute vertices only
M4
0
Guard Inference Accuracy
10 of 10 inferred guards manually verified correct. Tag-based inference is unambiguous
Synthesized model: 20 vertices · 25 edges · 10 guards  |  Guards: isLoggedIn (4) · canWrite (3) · !isValid (3)
Contribution 3

AI-Driven Coverage Gap Detection

1

Execute BDD Suite

Run against system under test; record per-edge execution history

↓
2

Build Execution History

Traversal count, failure count, failure category per edge

↓
3

MbtCoverageAdvisor → LLM

Submit model JSON + history → Claude / GPT-4o / Ollama

↓
4

Parse EdgeProposals

Validate JSON schema; filter by confidence threshold (≥ 0.7)

↓
5

Merge + Generate BDD Sketches

Provenance tag: source="AI", proposalRound=N; loop until convergence

EdgeProposal Schema
sourceVertexId
targetVertexId
edgeLabel
guard
rationale
confidence [0.0–1.0]
suggestedGherkin
LLM Providers
Claude Sonnet GPT-4o Mistral 7B Llama 3.1
5 Research Questions
RQ1: Gap types identified
RQ2: AI vs random precision
RQ3: Fault detection rate [19]
RQ4: History context impact
RQ5: LLM comparison
Research Roadmap

Future Work & Conclusion

1
Guard Implementation Generation
1–2 weeks
Framework
2
Multi-Domain Synthesis
3 weeks
ICST short
3
Incremental Synthesis
3–4 weeks
ICST full
4
Iterative Model Refinement
6–7 weeks
ICST full
5
Embedding-Based Normalization
7–10 weeks
ASE/FSE
6
Fault Detection Comparison
7–10 weeks
ICSE/ISSTA
Raw Gherkin scenarios  →  Executable GraphWalker model  →  AI-augmented, self-improving MBT  →  Full audit trail
Zero manual model authoring · 46% state compression · 100% guard inference accuracy · Complete traceability