Speaker Notes

Beyond Code Coverage: Functionality Testing with Playwright MCP — Marlene Mhangami, Microsoft

AI coding assistants accelerate commit volume, but maintaining productivity requires shifting from brittle unit tests to functional browser testing using Playwright and MCP.

AI Engineer · 19:45 · YouTube ↗

Talk · solo speaker  Intermediate · concepts and tooling for AI-driven testing

Highlights

3 clips · 3 min of 20 min
    • Unchecked AI code generation increases codebase entropy and rework time.
    • Clean codebases amplify the productivity gains of AI tools.
    • Relying solely on raw PR volume without quality controls yields zero net productivity gain.
    • AI can generate unit tests that pass while failing to validate actual system behavior.
    • Green test suites can create a false sense of security regarding code functionality.
    • Testing user-facing functionality via browsers helps bypass self-affirming unit test pitfalls.
    • Playwright MCP allows coding agents to execute browser interactions and verify UI features.
    • Automated tests can validate search inputs, category filters, and price ranges without manual intervention.
    • Visual verification confirms that application functionality matches feature requirements.

Questions this video answers

9 · every answer cites the moment it was said
01 How does rising AI code generation impact codebase quality? 2 sources · 2:49

While AI coding tools can increase the volume of pull requests, unchecked AI code generation often amplifies codebase entropy and technical debt. Studies show that without clean codebases, teams spend more time reworking and refactoring code, leading to little net productivity gain.

02 What is red-green TDD, and how does it fit agentic workflows? 2 sources · 5:18

Red-green TDD is a development workflow where you start by writing a failing test for a new feature request. In the green phase, you focus purely on speed to get the test to pass, followed by a dedicated refactoring phase to ensure code quality. When combined with AI, agents rapidly generate the failing tests and passing code, allowing developers to focus their time on refactoring.

03 Why do traditional unit tests fall short in modern development? 2 sources · 6:44

Traditional unit tests frequently overindex on code coverage and implementation details rather than verifying overall system behavior. This causes tests to break during refactoring even when the underlying functionality remains correct, and AI-generated unit tests can sometimes be self-affirming without validating real behavior.

04 What is Playwright, and how does it automate browser testing? 2 sources · 8:18

Playwright is an open-source testing framework built by Microsoft that automates end-to-end testing directly in the browser by simulating user interactions. It supports multiple programming languages like Python, TypeScript, and C#, and allows running tests in either headed or headless modes.

05 How can developers connect coding agents with Playwright? 2 sources · 10:17

Developers can connect their coding agents to Playwright using the Playwright MCP server, command-line tools, or specialized Playwright agents. Using Playwright agents installs specific markdown files that provide a planner, generator, and healer to manage testing workflows.

06 How do tools like Work IQ integrate M365 data into terminal workflows? 2 sources · 12:37

Work IQ is a Microsoft development skill that allows developers to connect the M365 suite directly to their terminal environment. This enables developers to pull project requirements and information from tools like Outlook or PowerPoint straight into command-line interfaces like Copilot CLI.

07 How does feature-driven testing replace traditional unit testing triggers? 2 sources · 13:07

While traditional unit testing is typically triggered by adding a new method to a class, modern agentic workflows focus testing on overall behavior and feature requests. When a new feature request arrives from a product management team, it serves as the direct trigger for writing behavioral tests.

08 What best practices should developers follow when using Playwright with AI? 2 sources · 16:28

Developers should capture screenshots of Playwright functionality tests and add them to pull requests to visually track changes. Additionally, running tests in headless mode and committing code before letting agents make changes ensures history and context are preserved.

09 How can developers handle complex state management in browser testing? 2 sources · 18:08

For complex applications with heavy state management, using specialized Playwright agents is recommended because they include built-in instructions tailored to handle state effectively. Alternatively, developers can choose to directly test APIs if an API is available instead of relying entirely on browser automation.

Section-by-section summary

4 parts

AI code volume surges while quality risks grow

GitHub commit volume is accelerating rapidly with a growing share co-authored by AI agents. However, studies show that unmanaged AI generation increases technical debt and code entropy. Maintaining high productivity requires clean codebases supported by strong testing and documentation standards.

Red-green TDD adapted for agentic workflows

Test-driven development is seeing a resurgence among developers using coding agents for feature implementation. Traditional TDD relies heavily on unit tests, which often over-index on implementation details and suffer from self-affirming tests generated by AI. Shifting focus to behavioral testing avoids brittle tests tied to internal method names.

Automated functional testing with Playwright and MCP

Playwright enables browser-based end-to-end testing by simulating real user interactions across multiple languages. Connecting coding agents to Playwright via the Model Context Protocol (MCP) or specialized agents accelerates the red-green-refactor cycle. Agents can automatically generate failing tests, write code to pass them, and validate functionality.

Live demonstration of AI-driven feature development

In a demonstration using GitHub Copilot and Playwright MCP, an agent successfully adds search and filter features to a toy store web application. The agent plans tests, runs them in a browser to verify functionality, and ensures the UI behaves as requested. Best practices include running tests in headless mode, capturing screenshots for PRs, and committing code before agent modifications.

0:00 / 19:45
k play/pause · f fullscreen · m mute
n next · p previous clip · t highlights/full
< > slower/faster · / search what was said
  • GitHub Octoverse1× · first 0:41

    An annual report providing data on how developers use GitHub.

  • Test-driven development7× · first 5:00

    A software development process where tests are written before implementing the corresponding code.

  • Playwright10× · first 8:14

    An open-source framework by Microsoft that automates end-to-end browser testing.

  • Playwright MCP server3× · first 10:18

    A server integration allowing coding agents to execute Playwright commands and tests.

  • Work IQ1× · first 12:41

    A Microsoft developer skill connecting M365 suite data to terminal environments.

  • Playwright agents2× · first 10:26

    Agent setups providing specialized markdown files for planning, generating, and healing tests.