惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
Martin Fowler
Martin Fowler
I
InfoQ
腾讯CDC
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
爱范儿
爱范儿
Microsoft Security Blog
Microsoft Security Blog
Google DeepMind News
Google DeepMind News
D
DataBreaches.Net
云风的 BLOG
云风的 BLOG
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
博客园 - 聂微东
Microsoft Azure Blog
Microsoft Azure Blog
D
Docker
博客园 - 三生石上(FineUI控件)
Y
Y Combinator Blog
博客园 - Franky
Engineering at Meta
Engineering at Meta
B
Blog
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research
Jina AI
Jina AI
V
Visual Studio Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Intelligent RAG powered Playwright code reviewer
Saurav Ghosh · 2026-05-05 · via DEV Community

Your Playwright Tests Are Lying to You (And How I Built a System to Catch It)

Your Playwright tests are passing.

But are they still testing what they were supposed to?

Over time, something subtle happens in most automation suites:

  • Assertions get removed
  • Requirements evolve
  • Tests are modified for quick fixes
  • Coverage silently drops

And yet… everything is still “green”.

This is what I call test drift — and most teams don’t even realize it’s happening.


🚨 The Problem: Passing Tests ≠ Correct Tests

In real-world projects, test suites grow quickly. But maintaining their correctness over time is hard.

Some common issues:

  • A test originally validated 3 things, now only validates 1
  • Jira requirements changed, but tests didn’t
  • Quick fixes removed important assertions
  • No visibility into what was lost over time

The worst part?

There’s no tool today that tells you your test is semantically incorrect.


🤖 Why Existing Tools Don’t Solve This

Tools like GitHub Copilot or Claude are great at:

  • Writing code
  • Suggesting improvements
  • Reviewing syntax

But they don’t:

  • Understand product requirements (from Jira)
  • Track historical changes in tests
  • Detect semantic drift over time
  • Compare intent vs implementation

They work on current code, not context across time and systems.


💡 The Idea: A Requirement-Aware Test Drift Analyzer

So I built a system that answers a deeper question:

“Is this test still validating what it was originally supposed to?”

The system combines:

  • Jira requirements
  • Playwright test code
  • Git history
  • RAG (Retrieval Augmented Generation)

And performs semantic analysis across all of them.


🧠 How It Works (High-Level)

Jira → Requirement Intent  
        ↓
Test Code → Test Intent  
        ↓
Git History → Change Analysis  
        ↓
RAG → Context Retrieval  
        ↓
LLM → Drift + Coverage Analysis  

Enter fullscreen mode Exit fullscreen mode


Step 1: Extract Requirement Intent

From Jira tickets, the system extracts:

  • Expected behaviors
  • Validation scenarios

Step 2: Extract Test Intent

From Playwright tests, it identifies:

  • What the test is actually validating
  • Assertions and flows

Step 3: Analyze Git History

It looks at:

  • What changed in the test over time
  • What assertions were removed
  • Whether coverage degraded

Step 4: Use RAG for Context

The system uses embeddings to:

  • Understand the repository semantically
  • Retrieve relevant historical and related code

Step 5: Detect Drift

Finally, it compares:

  • Requirement vs Test Intent
  • Past vs Current Implementation

📊 Example Output

⚠️ Drift Detected

Test: login.spec.ts

Missing:
- Error message validation for invalid login

History:
- Assertion for dashboard visibility removed 2 commits ago

Coverage: 65%

Suggestion:
- Refer auth/error.spec.ts for correct implementation

Enter fullscreen mode Exit fullscreen mode


🔍 The Most Useful Feature

One thing I found extremely powerful:

When a test is missing something, the system finds another test in the repo that already implements it.

So instead of just saying:

“This is missing…”

It says:

“This is missing, and here’s how it’s already done elsewhere.”

This helps with:

  • Faster fixes
  • Standardization
  • Knowledge reuse

⚙️ Tech Stack

  • Python
  • LangChain
  • ChromaDB (vector search)
  • sentence-transformers / Ollama (local embeddings)
  • Claude API (reasoning)
  • Jira API
  • Git history analysis

🚀 What Makes This Different

This is not just another AI code reviewer.

It:

  • Aligns tests with product requirements
  • Detects semantic drift over time
  • Uses Git history as context
  • Applies RAG for repository-level understanding
  • Suggests existing implementations for missing coverage

🧪 What’s Next

Some ideas I’m exploring:

  • Running Playwright tests to validate runtime behavior
  • Auto-suggesting safe fixes
  • Improving retrieval accuracy
  • Supporting more frameworks

👇 Final Thoughts

We spend a lot of time making tests pass.

But very little time asking:

“Are they still testing the right thing?”

This project is a step toward answering that.


Would love to hear:

  • How do you deal with test drift today?
  • Do your tests stay aligned with requirements over time?

Happy to discuss ideas or improvements!

ai #testing #playwright #rag #python