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

推荐订阅源

OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
J
Java Code Geeks
Blog — PlanetScale
Blog — PlanetScale
F
Fortinet All Blogs
腾讯CDC
大猫的无限游戏
大猫的无限游戏
Jina AI
Jina AI
WordPress大学
WordPress大学
雷峰网
雷峰网
小众软件
小众软件
D
DataBreaches.Net
V
Visual Studio Blog
博客园 - Franky
IT之家
IT之家
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog RSS Feed
博客园 - 聂微东
T
Tailwind CSS Blog
有赞技术团队
有赞技术团队
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Security Blog
Microsoft Security Blog
G
Google Developers Blog
云风的 BLOG
云风的 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
Building ResuMatch AI with TDD and AI-Assisted Developmen...
Mohamed Afiq · 2026-05-15 · via DEV Community

🎯 Why I Started Experimenting with This

While building ResuMatch AI, I ran into a problem I didn’t expect:

AI could generate code extremely fast… but it could also confidently generate the wrong implementation.

At first, I was treating AI like an autopilot.. blindly accepting all the changes ..

Eventually I realized something important:

If I couldn’t clearly define the expected behavior first, I couldn’t properly review the AI’s output either.

That pushed me into learning Test-Driven Development (TDD) more seriously while building actual features in my project.

This article isn’t a guide on “the best way” to build AI systems. It’s mostly a reflection on what I learned while combining TDD, ASP.NET Core, and AI-assisted development in a real application.

🧠 The Mental Model That Changed Everything

One idea from my mentorship sessions really stuck with me:

You are the architect of intent.
The AI is the implementation engine.

That completely changed how I worked with AI.

Instead of asking AI to “build the feature,” I started:

  1. Defining the expected behavior first
  2. Writing failing tests
  3. Letting AI implement against those tests
  4. Reviewing whether the implementation actually satisfied the contract

The tests became the control mechanism... not the AI.

🏗️ The Feature I Used to Practice TDD

One of the first features I implemented this way in ResuMatch AI was a daily generation limit system.

The idea was simple:

  • Free users can only generate 3 tailored applications per day
  • Usage resets daily
  • Backend should block requests once the limit is reached

Instead of jumping straight into implementation, I started with test scenarios first.

🔴 Red → 🟢 Green → 🔵 Refactor

I followed the classic TDD cycle:

Write failing test
↓
Run tests (RED)
↓
Implement minimum code
↓
Run tests again (GREEN)
↓
Clean up implementation (REFACTOR)

Enter fullscreen mode Exit fullscreen mode

What surprised me was how useful this became when working with AI-generated code.

Without tests, it was easy to accept code that “looked correct.”

With tests, incorrect assumptions surfaced immediately.

✍️ Writing the Behaviors First

Before implementation, I wrote the feature scenarios as test method names:

[Fact]
public async Task CreateApplication_WhenUserHasThreeGenerationsToday_ShouldThrowDailyLimitExceededException()

[Fact]
public async Task CreateApplication_WhenUserHadThreeGenerationsYesterday_ShouldSucceed()

[Fact]
public async Task CreateApplication_WhenNoUsageRowExists_ShouldCreateUsageRowWithCountOne()

Enter fullscreen mode Exit fullscreen mode

This was probably the biggest learning moment for me.

The test names themselves became executable requirements.

If I couldn’t clearly name the scenario, I usually didn’t fully understand the business rule yet.

🤖 Where AI Actually Helped

Once the test structure was clear, AI became much more useful.

I used it to:

  • Fill in repetitive Arrange/Act/Assert sections
// File: Unit/Services/ApplicationServiceTests.cs

namespace ResuMatch.Tests.Unit.Services;

public class ApplicationServiceTests
{
    // SCENARIO 1: Happy path — user is under the limit
    [Fact]
    public async Task CreateApplication_WhenUserHasZeroGenerationsToday_ShouldSucceed()
    {
        // YOU write this comment structure:
        // Arrange: user exists, no UserUsage row for today
        // Act: call CreateApplicationAsync
        // Assert: returns valid Guid, no exception
    }

    // SCENARIO 2: Edge case — exactly at limit (2 out of 3 used)
    [Fact]
    public async Task CreateApplication_WhenUserHasTwoGenerationsToday_ShouldSucceed()
    {
        // Arrange: UserUsage row exists with GenerationCount = 2
        // Act: call CreateApplicationAsync
        // Assert: succeeds, GenerationCount becomes 3
    }

// Many more scenarios

Enter fullscreen mode Exit fullscreen mode

  • Generate boilerplate EF Core setup
  • Implement DTOs and exception classes
  • Suggest minimal production code changes

For example, after defining the expected behavior, I could prompt the AI with very targeted instructions:

  • Modify ApplicationService to make these tests pass.
  • Do not change method names.
  • Do not modify unrelated logic.
  • Use DateOnly.FromDateTime(DateTime.UtcNow).

That produced far better results than vague prompts like:

“Build a rate limiting feature for this application and only allow 3 attempts”

In conclusion, TDD doesn't make AI deterministic. It makes your integration reliable, your refactoring safe, and your debugging sane. If you're building with AI-Assisted development, don't skip the tests. Your future self will thank you.

💬 Let's Connect!

Have you tried TDD with AI agents? What challenges did you face?
Drop a comment below or connect with me:

GitHub: [https://github.com/mafiqqq]
LinkedIn: [https://www.linkedin.com/in/afiqqqx/]