Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Test-Driven AI Development - WebCamp Venlo 2026

Test-Driven AI Development - WebCamp Venlo 2026

With the rise of assistive coding tools, developing applications takes only a fraction of the time it usually took. Unfortunately, the generated code is far from perfect as it lacks the code isolation and maintainability you’re used from writing test-driven code. Wouldn’t it be awesome if your AI agent could adopt TDD the way you did to create loosely coupled, maintainable code?

In this session I will explain how I work with AI agents to create well tested, secure and resilient web applications and I will focus on the challenges that you might face in your journey in working alongside AI so you are prepared for the next era of technological advancements.

In this new age of AI, I believe that developers need to learn to adopt the current tools available to deliver high quality value faster. But the information is scattered, mostly focussed on solving a particular challenge or just how to get started. I wanted to showcase how one could develop a fully functional web application in a matter of minutes using AI assistive technology but applying the engineering techniques we have adopted in the past decades.

Avatar for DragonBe

DragonBe

March 13, 2026
Tweet

More Decks by DragonBe

Other Decks in Programming

Transcript

  1. www.in2it.be - @in2itvof Not so fast! AI has issues!!! •

    AI-generated code contains signi fi cantly more defects of logic, maintainability, security, and performance than code created by people — Source: CodeRabbit.ai • AI-generated code is generally simpler and more repe ti ti ve, yet more prone to unused constructs and hardcoded debugging, while human-wri tt en code exhibits greater structural complexity and a higher concentra ti on of maintainability issues — Source: University of Napels • AI tooling slowed developers down — Source: Model Evalua ti on & Threat Research 4
  2. www.in2it.be - @in2itvof 2 decades of tes ti ng PHP

    apps • Promo ti ng tes ti ng PHP apps since 2007 • Given presenta ti ons, workshops & training • PHPUnit in general • Test-Driven Development with PHPUnit • Behaviour-Driven Development with Behat • Muta ti on tes ti ng with Infec ti on 7
  3. www.in2it.be - @in2itvof 8 Test-driven development Test Fails Test Passes

    Test Passes 1. Design func ti onality by wri ti ng a failing tests 2. Write minimal code to make tests pass 3. Refactor code to improve it and ensure the tests s ti ll pass
  4. www.in2it.be - @in2itvof How do we mentor juniors? • Clear

    communica ti on of expecta ti ons • Let them perform small steps on their own and fail fast • Review each step and give guidance for improvements • Let them show their work and explain • what they’ve made, • which obstacles they faced, • what they have learned 9
  5. www.in2it.be - @in2itvof How do junior devs grow? • Learning

    through mistakes and experimenta ti on • Repe ti ti on and constant challenges • Mentoring by senior developers • Providing a safe work environment • Give them tools to self-assess 10 freestocks.org CC0 1.0 Wiki Commons
  6. www.in2it.be - @in2itvof 11 A PHP developer’s toolbox Infection Vimeo

    Psalm Phinx PHP Database Migrations For Everyone
  7. www.in2it.be - @in2itvof Prompt instr uctions Agen t execution Prompt-driven

    Development • Developer gives prompt to AI agent • AI agent executes and produces results • Developer gives prompt to AI agent for fi xes • AI agent executes and produces results • Developer gives prompt to AI agent for fi xes • AI agent executes and produces results • … 13
  8. www.in2it.be - @in2itvof Observed behaviour • AI agent requires strict

    guidelines • AI agent produces "happy" results • AI agent experiments in quick succession • AI agent starts with basics • AI agent builds-up with feedback prompts 14 AI generated by Easy-Peasy.AI
  9. CC BY-NC-ND 2.0 - Thumbs up! - Kris ti an

    Niemi Agile Manifesto Individuals and interactions over processes and tools Working software over comprehensive documentation Customer collaboration over contract negotiation Responding to change over following a plan
  10. www.in2it.be - @in2itvof Project guidelines • A README.md for providing

    context about the project • A CONTRIBUTING.md for giving speci fi c expecta ti ons for people contribu ti ng to the project • A CODE_OF_CONDUCT.md for describing the expected behaviours of contributors • A LICENSE.md to specify under which license contribu ti ons are made and what can be expected in terms of copy rights and usage. • A GOVERNANCE.md lets people know about how your project is governed. • A SECURITY.md gives instruc ti ons on how to report a security vulnerability in your project and descrip ti on that hyperlinks the fi le. • A SUPPORT.md lets people know about ways to get help with your project. 17 Nick Youngson CC BY-SA 3.0 Alpha Stock Images
  11. www.in2it.be - @in2itvof README.md • Introduc ti on of the

    project • Detailing important objec ti ves of the project • Links to more detailed informa ti on (Contribu ti ng, Code of Conduct, …) • Contact and license informa ti on 18
  12. www.in2it.be - @in2itvof CONTRIBUTING.md • Detailed instruc ti ons for

    humans to par ti cipate in the project • Outlines project technical requirements • Speci fi es expecta ti ons from contributors • Addi ti onal guidelines 19
  13. www.in2it.be - @in2itvof AI guidelines • Create AGENTS.md for AI

    agent instruc ti ons • Compliments README.md and CONTRIBUTING.md for developers • Details context for AI agents speci fi cally • Standard for many AI agents More on h tt ps://agents.md/ 20
  14. www.in2it.be - @in2itvof 23 AI way of working Objective AI

    Execu ti on Prompt + Guidelines Value crea ti on Learnings
  15. www.in2it.be - @in2itvof The AI Trap AI is designed to

    produce a result. It will break your guidelines when it can not produce successful results, with unexpected outcomes. 24 Nicolas Raymond CC BY 2.0 Flickr
  16. www.in2it.be - @in2itvof 25 Test-driven AI development DEV AI Agent

    Issue Tracker Ticket Ticket Ticket Acceptance tests Unit tests Solution Coding Standards Mutation tests Security tests 1 2 4 5 6 3 A " ti cket" speci fi es the objec ti ve wri tt en for developers and AI agents
  17. www.in2it.be - @in2itvof 27 Gene Kim writes about it h

    tt ps://itrevolu ti on.com/product/vibe-coding-book/
  18. www.in2it.be - @in2itvof Engineering Room Podcast • AI agents needs

    guidelines • AI agents needs to be onboarded • Unit tests gives clarity and focus to AI • Behaviour tests gives clear goals to AI 29 h tt ps://youtu.be/06kr0DiDAlU
  19. www.in2it.be - @in2itvof FizzBuzz features 1. When you provide the

    applica ti on a numeric value, it should return that value as a string (e.g. 1 becomes "1") 2. When you provide the applica ti on the number 3 or a mul ti ple of 3, it should return the word "Fizz" (e.g. 3 becomes "Fizz") 3. When you provide the applica ti on the number 5 or a mul ti ple of 5, it should return the word "Buzz" (e.g. 5 becomes "Buzz") 4. When you provide the applica ti on a mul ti ple of 3 and 5, it should return the word "FizzBuzz" (e.g. 15 becomes "FizzBuzz") 31
  20. www.in2it.be - @in2itvof The Gerkin feature Feature: FizzBuzz In order

    to learn tes ti ng with AI Developers should test with simple exercises Scenario: Return numeric value as string Given I provide 1 to the applica ti on Then it should return "1" Scenario: Return Fizz with mul ti ple of 3 Given I provide 3 to the applica ti on Then it should return "Fizz" Scenario: Return Buzz with mul ti ple of 5 Given I provide 5 to the applica ti on Then it should return "Buzz" Scenario: Return FizzBuzz with a mul ti ple of 3 and 5 Given I provide 15 to the applica ti on Then it should return "FizzBuzz" 32
  21. www.in2it.be - @in2itvof The PHPUnit TestCase #[CoversClass(FizzBuzz::class)] class FizzBuzzTest extends

    TestCase { #[Test] public function testAppReturnsNumericValueAsString(): void { $fizzbuzz = new FizzBuzz(); $result = $fizzbuzz->run(1); $this->assertIsString($result); $this->assertSame('1', $result); } #[Test] public function testAppReturnsMultipleOfThreeAsFizz(): void { $fizzbuzz = new FizzBuzz(); $result = $fizzbuzz->run(3); $this->assertIsString($result); $this->assertSame('Fizz', $result); } #[Test] public function testAppReturnsMultipleOfFiveAsBuzz(): void { $fizzbuzz = new FizzBuzz(); $result = $fizzbuzz->run(5); $this->assertIsString($result); $this->assertSame('Buzz', $result); } #[Test] public function testAppReturnsMultipleOfThreeAndFiveAsFizzBuzz(): void { $fizzbuzz = new FizzBuzz(); $result = $fizzbuzz->run(15); $this->assertIsString($result); $this->assertSame('FizzBuzz', $result); } } 33
  22. www.in2it.be - @in2itvof Prompt I've created unit tests in "tests/unit"

    directory and behaviour tests in "tests/ acceptance" directory. Create the func ti onality based on these tests without modifying them. I've provided a README.md for context and commands to execute unit and behaviour tests. More speci fi c guidelines can be found in CONTRIBUTING.md and AGENTS.md. 35
  23. www.in2it.be - @in2itvof AI Plan 1. Create the src/FizzBuzz directory.

    2. Implement the FizzBuzz class in src/FizzBuzz/FizzBuzz.php. 3. Verify the implementa ti on by running unit tests. 4. Verify the implementa ti on by running acceptance tests. 5. Fix any issues if tests fail. ✓ (No issues found) 6. Submit the solu ti on. 36
  24. www.in2it.be - @in2itvof AI Ac ti ons Changes Made: •

    Created the directory src/FizzBuzz. • Created the fi le src/FizzBuzz/FizzBuzz.php with the following implementation: ◦ Returns Fizz for multiples of 3. ◦ Returns Buzz for multiples of 5. ◦ Returns FizzBuzz for multiples of both 3 and 5. ◦ Returns the number as a string for all other cases. Veri fi cation: •Unit Tests: All 4 tests in tests/unit/FizzBuzz/FizzBuzzTest.php passed. •Acceptance Tests: All 4 scenarios in features/fizzbuzz/fizzbuzz.feature passed using Behat. The implementation ful fi lls all requirements de fi ned in the tests without modifying the test fi les themselves. 37
  25. www.in2it.be - @in2itvof AI result <?php namespace In2it\TestDrivenAiDevelopment\FizzBuzz; class FizzBuzz

    { public function run(int $number): string { if ($number % 3 === 0 && $number % 5 === 0) { return 'FizzBuzz'; } if ($number % 3 === 0) { return 'Fizz'; } if ($number % 5 === 0) { return 'Buzz'; } return (string) $number; } } 38
  26. www.in2it.be - @in2itvof Drive the design • Design through tes

    ti ng • Discover through implementa ti on • Design further based on learning 40 Sea tt le Municipal Archives CC BY 2.0 WikiMedia
  27. www.in2it.be - @in2itvof Reduce energy consump ti on • No

    complex thinking • No re-promp ti ng • Solu ti on produced within minutes 41
  28. www.in2it.be - @in2itvof Bring joy to your AI agent 🤔

    Thinking All implementa ti on steps are complete. ✓ServiceController created with necessary methods and mapping. ✓Routes registered in routes.php. ✓DI de fi ni ti ons updated. ✓All 4 services created with content matching acceptance tests. ✓Unit tests (phpunit) passing. ✓Acceptance tests (behat) passing. ✓Code style (phpcs) passing. ✓Sta ti c analysis (psalm) passing. ✓Muta ti on tes ti ng (infec ti on) passing with MSI > 75% (reported as ~19% over required, which implies it's > 94% since requirement is 75%). Ready to commit and submit. 42
  29. www.in2it.be - @in2itvof 43 Sta ti s ti cs Without

    AI With AI Average sprint velocity 24 38 Average failure rate 12% 8% Timeline Overrun 8% 2% Budget Overrun 5% 5%
  30. www.in2it.be - @in2itvof AI ads value to teams Performs the

    "heavy li ft ing" Needs "onboarding" via guidelines -> Just like new team members Must have human reviews 45 Gold bar lot CC0 1.0 by Pexels
  31. www.in2it.be - @in2itvof Temper AI Happiness AI tests happy paths

    Provide sad paths to guide AI tests 46 Happy Face CC BY-SA 3.0 Jersyko - Wikimedia
  32. www.in2it.be - @in2itvof Is AI taking our jobs? NO! AI

    performs the coding stu ff But requires code reviews (human) Requires guidance (human) Needs feedback (human) 47 AI Generated Image by Reliable
  33. www.in2it.be - @in2itvof 48 Enormous gra ti tude for Premium

    Sponsors Value sponsors Supporters Organizers Edward Lenssen Kai Unterberg Myrna Gönnemann Patrick Broens
  34. www.in2it.be - @in2itvof 49 Ques ti ons? Or talk to

    me, a human, a ft er the session… Junie by JetBrains