Executive Summary
As AI coding assistants accelerate software development, engineering velocity is increasingly throttled not by code authoring speed, but by verification velocity. Developers must evaluate more generated code in less time. Automated tests are the primary mechanism for expressing expected behavior in runnable form and providing deterministic feedback loops to coding agents.
However, green test suites can be deceptively reassuring. When an AI agent authors both the production implementation and its accompanying tests, any misunderstanding of business requirements is mirrored across both artifacts. The test suite passes completely while failing to verify actual intended business behavior—a phenomenon Barlow terms the "Green Suite Illusion".
In this session, McKenna Barlow presents Microsoft's comprehensive strategy for modern .NET testing across two pillars:
- The Modern Testing Foundation: The architectural evolution of Microsoft Testing Platform (MTP) and MSTest, transforming test projects into self-contained, native executable applications supporting Hot Reload, cross-framework diagnostic extensions, and Native AOT.
- AI-Assisted Test Quality & Auditing: Leveraging dedicated Test Agents in Visual Studio, polyglot CLI agents, and the official .NET Skills repository (
github.com/dotnet/skills) to move beyond blind test generation. Barlow demonstrates how to ground test generation in specification requirements (e.g.README.md), catch subtle boundary condition bugs, audit weak assertions (such asAssert.IsNotNullortotal > 0), and automatically grade test quality (from A to F) during CI/CD pull request reviews.
Visual Timeline & Key Moments
| Timestamp | Screenshot | Core Technical Topic |
|---|---|---|
00:00:15 |
01-title-test-smarter-ai-testing.jpg | Session introduction: McKenna Barlow on AI-assisted testing for modern .NET. |
00:00:45 |
02-why-testing-matters-with-ai.jpg | The Verification Paradox: Why tests matter more when AI accelerates code output. |
00:02:45 |
03-developer-testing-workflow-stack.jpg | The .NET testing workflow stack: VS Test Explorer, VS Code C# Dev Kit, and dotnet test. |
00:04:05 |
04-dedicated-test-agent-visual-studio.jpg | Dedicated Test Agent in Visual Studio Copilot Chat and polyglot CLI test agent. |
00:05:05 |
05-dotnet-skills-testing-plugin.jpg | The .NET Skills repo (dotnet/skills): Test Plugin (assertion-quality, test-gap-analysis). |
00:06:45 |
06-framework-vs-platform-mstest-mtp.jpg | Distinguishing Test Framework (MSTest, attributes, assertions) from Test Platform (MTP host). |
00:07:45 |
07-microsoft-testing-platform-benefits.jpg | Microsoft Testing Platform architecture: embedded test app, Hot Reload, Native AOT. |
00:09:45 |
08-demo-order-quote-readme-specs.jpg | Demo: Order Quote Calculator specifications in README.md (free shipping threshold >= $100). |
00:11:35 |
09-demo-baseline-10-passing-tests.jpg | Baseline suite: 10 green passing tests in Test Explorer giving false initial confidence. |
00:12:45 |
10-demo-mtp-hot-reload-shipping-failure.jpg | MTP Hot Reload in action: deliberately injecting $49.99 shipping bug instantly caught live. |
00:14:40 |
11-demo-test-agent-grounded-generation.jpg | Prompting VS Test Agent with README.md grounding to avoid circular confirmation bias. |
00:16:45 |
12-demo-boundary-bug-detected-at-100.jpg | Agent-generated test exposes boundary bug: subtotal > 100 failed for order exactly at $100. |
00:19:35 |
13-demo-assertion-quality-audit-table.jpg | assertion-quality skill assessment table: mapping tests to behaviors that could silently pass. |
00:20:45 |
14-demo-weak-assertion-not-null-greater-zero.jpg | Inspecting weak assertions: Assert.IsNotNull(quote) and quote.Total > 0 proving zero verification. |
00:22:25 |
15-demo-strengthened-assertions-diff.jpg | Git diff: Copilot strengthens assertions to verify exact expected arithmetic calculations. |
00:24:45 |
16-demo-pr-test-quality-grading-review.jpg | Automated PR review: GitHub Actions workflow grading test quality A through F (flagging tautologies). |
1. The Verification Paradox in AI-Assisted Development
The adoption of AI coding agents creates an asymmetry in software engineering:
- Code Generation Velocity: Approaching near-instantaneous synthesis of complex methods, controllers, and classes.
- Code Verification Velocity: Bounded by human cognitive bandwidth to review diffs and ascertain correctness.
┌─────────────────────────────────────────────────────────────┐
│ THE GREEN SUITE ILLUSION │
│ │
│ Agent Prompts: "Implement quote calculator and tests" │
│ │
│ ┌────────────────────────┐ ┌────────────────────┐ │
│ │ Implementation Logic │ │ Generated Unit Test│ │
│ │ (Flawed Assumption) │ <===> │ (Mirrored Flaw) │ │
│ └────────────────────────┘ └────────────────────┘ │
│ ▼ ▼ │
│ Code returns $4.99 shipping Test asserts $4.99 ship │
│ │
│ RESULT: ALL TESTS GREEN (PASS) │
│ False sense of safety with zero protection! │
└─────────────────────────────────────────────────────────────┘
[!WARNING]
A completely green test suite is not proof of correctness. When an AI generates both implementation and tests, circular reasoning often prevails. The test merely checks whether the code agrees with itself, rather than whether it fulfills real business requirements.
2. The Modern .NET Testing Foundation: Framework vs. Platform
Barlow clarifies the foundational separation of responsibilities within modern .NET testing:
graph TD
subgraph TestFramework["Test Framework Layer (e.g. MSTest 3.x)"]
F1["Test Attributes: [TestClass], [TestMethod]"]
F2["Assertion Libraries: Assert.AreEqual(), Assert.Throws()"]
F3["Roslyn Analyzers: MSTEST0001 - MSTEST0030"]
F4["Automated Code Fixes"]
end
subgraph TestPlatform["Test Platform Layer (Microsoft Testing Platform - MTP)"]
P1["Self-Hosted Executable: OutputType = Exe"]
P2["Eliminates External VSTest Runner Process Overhead"]
P3["Unified Extensibility: Code Coverage, Hang/Crash Dumps, TRX"]
P4["Inner-Loop Hot Reload in Console Host"]
P5["Native AOT Ready Execution"]
end
subgraph ToolingSurfaces["Developer Tooling Surfaces"]
T1["Visual Studio Test Explorer"]
T2["VS Code C# Dev Kit"]
T3["CLI: dotnet test / direct binary execution"]
T4["GitHub Actions & Azure Pipelines"]
end
TestFramework --> TestPlatform
TestPlatform --> ToolingSurfaces
Microsoft Testing Platform (MTP) Innovations
Historically, running .NET tests required invoking vstest.console.exe or launching out-of-process test execution controllers. MTP fundamentally re-architects this model:
- Embedded Application Architecture: The test project itself compiles into a standalone executable (
OutputType=Exe). Developers can launch, debug, or profile the test project directly using standard .NET debugging tools. - Unified Extension Pipeline: Diagnostic capabilities (code coverage, crash dumps, hang dumps, TRX reporters) are registered as platform extensions, eliminating framework-specific implementations.
- Hot Reload in Console Host: When launched directly as an application, MTP listens for edit-and-continue delta changes. Developers modify production or test code and rerun tests in the existing process memory space in milliseconds, without triggering a full rebuild or restart.
- Native AOT Compatible: Because tests run as standard console binaries without dynamic reflection runners, MTP test suites can compile with Native AOT for lightning-fast container startup and headless CI/CD execution.
3. Grounded Test Generation: Breaking Confirmation Bias
To prevent AI from locking in existing bugs, Barlow demonstrates how to properly ground test generation in external specifications rather than existing code.
The Sample Domain: Order Quote Calculator
- Business Rule: Subtotal equals sum of unit price times quantity.
- Shipping Rule: If merchandise subtotal is $100 or more, shipping is FREE ($0.00); otherwise shipping is $4.99.
- Initial Code: The calculator implementation contained a subtle off-by-one boundary defect:
// BUGGY IMPLEMENTATION IN OrderQuoteCalculator.cs: decimal shipping = subtotal > 100m ? 0m : 4.99m; // Uses strictly greater than!
The Initial Suite: 10 Passing Baseline Tests
The initial test suite had 10 tests, all green. Tests included cases for subtotal under $100 ($75.00 -> $4.99 shipping) and well over $100 ($150.00 -> free shipping). None exercised the boundary condition.
Grounded Prompting Strategy
Rather than asking Copilot to "write more tests for this class", Barlow prompts the Visual Studio Test Agent (@test) with strict grounding:
@test Review the business requirements in README.md and the public API of OrderQuoteCalculator.
Generate additional unit tests for missing edge cases based on the README specifications.
Do not modify the application code. Keep any failing tests so we can evaluate disagreements.
Exposing the Boundary Defect
The Test Agent generated three edge-case tests, including:
[TestMethod]
public void CalculateSubtotal_ExactlyAtThreshold_QualifiesForFreeShipping()
{
var calculator = new OrderQuoteCalculator();
var quote = calculator.Calculate(new[] { new MerchandiseLine("Item", 100m, 1) });
Assert.AreEqual(100m, quote.Subtotal);
Assert.AreEqual(0m, quote.Shipping); // EXPECTS: $0.00
Assert.AreEqual(100m, quote.Total);
}
Result: Test failed with Assert.AreEqual failed. Expected:<0>. Actual:<4.99>.
By cross-referencing README.md ("$100 or more"), the developer verified the implementation was buggy. Updating the code to subtotal >= 100m turned all 13 tests green.
4. Auditing Assertion Quality with the assertion-quality Skill
A test method with a descriptive name and a passing green bar can still provide zero actual verification if its assertions are too weak. Barlow uses the assertion-quality skill from the official .NET Skills repository (dotnet/skills) to audit existing tests.
@copilot Using the assertion-quality skill and the business requirements in README.md,
examine the assertions in QuoteCalculatorTests.cs.
Provide an assessment table showing what each assertion establishes and what incorrect
behavior could still pass before making any changes.
The Assessment Matrix
Copilot analyzed the suite and produced a diagnostic table highlighting two critical vulnerabilities:
| Test Method Name | What the Assertion Establishes | Incorrect Behavior That Could Still Pass | Severity |
|---|---|---|---|
CalculateMultipleLineSums_PricesTimesQuantities |
Only checks that returned quote != null. |
• Sum calculation completely omitted. • Multiplication by quantity skipped. • Drops line items entirely. |
HIGH (CRITICAL) |
CalculatePaidShipping_AddsShippingToSubtotal |
Only checks quote.Total > 0. |
• Shipping charge never added to subtotal. • Negative shipping applied if merchandise > shipping. |
HIGH (CRITICAL) |
RejectsNegativePrice |
Asserts ArgumentOutOfRangeException. |
None (assertion correctly verifies thrown exception type). | LOW |
Weak Assertion Code vs. Strengthened Fix
Weak Test 1: Null Check Only
// BEFORE: Weak assertion masquerading as a math verification
[TestMethod]
public void CalculateMultipleLineSums_PricesTimesQuantities()
{
var lines = new[] { new MerchandiseLine("A", 10m, 2), new MerchandiseLine("B", 5m, 3) };
var quote = new OrderQuoteCalculator().Calculate(lines);
// WEAK: As long as ANY object is returned, this test passes!
Assert.IsNotNull(quote);
}
// AFTER: Strengthened with deterministic arithmetic verification
[TestMethod]
public void CalculateMultipleLineSums_PricesTimesQuantities()
{
var lines = new[] { new MerchandiseLine("A", 10m, 2), new MerchandiseLine("B", 5m, 3) };
var quote = new OrderQuoteCalculator().Calculate(lines);
Assert.IsNotNull(quote);
Assert.AreEqual(35m, quote.Subtotal); // (10 * 2) + (5 * 3) = 35
Assert.AreEqual(4.99m, quote.Shipping);
Assert.AreEqual(39.99m, quote.Total);
}
Weak Test 2: Total > 0
// BEFORE: Greater-than-zero check
[TestMethod]
public void CalculatePaidShipping_AddsShippingToSubtotal()
{
var lines = new[] { new MerchandiseLine("A", 20m, 1) };
var quote = new OrderQuoteCalculator().Calculate(lines);
// WEAK: Subtotal is 20, which is > 0. If shipping is completely forgotten, test passes!
Assert.IsTrue(quote.Total > 0);
}
// AFTER: Strengthened with exact value expectation
[TestMethod]
public void CalculatePaidShipping_AddsShippingToSubtotal()
{
var lines = new[] { new MerchandiseLine("A", 20m, 1) };
var quote = new OrderQuoteCalculator().Calculate(lines);
Assert.AreEqual(24.99m, quote.Total); // Exactly subtotal (20) + shipping (4.99)
}
5. Automated PR Reviews: Grading Test Quality in CI/CD
Barlow demonstrates how these testing skills integrate into GitHub Actions workflows to grade test quality during pull request reviews.
In a demo PR containing five tests that all passed serially, an automated GitHub Actions bot ran a Test Quality Review:
┌────────────────────────────────────────────────────────────────────────┐
│ PULL REQUEST TEST QUALITY REVIEW │
├─────────┬──────┬───────────────────────────────────────────────────────┤
│ Test │ Grade│ Finding / Recommendation │
├─────────┼──────┼───────────────────────────────────────────────────────┤
│ Test 1 │ F │ TAUTOLOGY: Calculates expected value by calling the │
│ │ │ same method under test! Flagged for circular logic. │
│ │ │ Suggestion: Hardcode expected value (e.g. 50). │
├─────────┼──────┼───────────────────────────────────────────────────────┤
│ Test 2 │ C │ WEAK ASSERTION: Only checks non-empty collection; │
│ │ │ does not verify element ordering or properties. │
├─────────┼──────┼───────────────────────────────────────────────────────┤
│ Test 3 │ B │ ACCEPTABLE: Checks values but misses negative inputs. │
├─────────┼──────┼───────────────────────────────────────────────────────┤
│ Test 4 │ B │ ACCEPTABLE: Validates state change; missing boundary. │
├─────────┼──────┼───────────────────────────────────────────────────────┤
│ Test 5 │ A │ EXCELLENT: Independent, explicit ground-truth check; │
│ │ │ verifies side-effects and return values thoroughly. │
└─────────┴──────┴───────────────────────────────────────────────────────┘
The "Grade F" Test: Tautological Testing
// THE GRADE F TAUTOLOGICAL DEFECT:
[TestMethod]
public void CalculatePassPercentage_HalfPassing_ReturnsFifty()
{
var results = GetMockResults(5, 5); // 5 pass, 5 fail
// TAUTOLOGY: Using the method under test to calculate the expected value!
var expected = TestReporter.CalculatePercentage(5, 10);
var actual = TestReporter.CalculatePercentage(5, 10);
Assert.AreEqual(expected, actual); // ALWAYS PASSES, EVEN IF FORMULA IS COMPLETELY BROKEN!
}
The automated reviewer caught that expected and actual were calling the identical routine, turning a unit test into an empty identity check.
6. The .NET Skills Ecosystem for Testing
All demonstrated capabilities are powered by open-source skills hosted in github.com/dotnet/skills.
graph LR
subgraph Repo["github.com/dotnet/skills"]
direction TB
subgraph TestPlugin["Test Plugin"]
S1["assertion-quality<br/>Audits and strengthens assertions"]
S2["test-gap-analysis<br/>Identifies missing edge cases & branches"]
S3["test-anti-patterns<br/>Detects tautologies, broad catches & sleeps"]
S4["polyglot-test-agent<br/>Autonomous agent for CLI / VS Code"]
end
subgraph MigrationPlugin["Test Migration Plugin"]
M1["xunit-to-mstest / nunit-to-mstest"]
M2["vstest-to-mtp<br/>Migrates runners to Native MTP executables"]
M3["test-sdk-v2-migration"]
end
end
Available Testing Skills
assertion-quality: Evaluates existing assertions against stated requirements and flags conditions where incorrect behavior would still pass.test-gap-analysis: Identifies untested codepaths, edge cases, and boundary conditions without relying solely on simple line coverage.polyglot-test-agent: Agent wrapper compatible with GitHub Copilot CLI, Visual Studio, and VS Code C# Dev Kit.test-migration: Automates upgrading legacy test suites from VSTest to Microsoft Testing Platform (MTP), converting test project files to standalone executables.
Technical Recommendations for .NET Engineering Teams
- Adopt Microsoft Testing Platform (MTP): Convert legacy test projects to standalone executables using MTP to benefit from Native AOT, cross-framework diagnostic extensions, and Hot Reload.
- Never Let Agents Verify Their Own Code Unsupervised: Always decouple test generation from implementation generation. Ground test authoring in markdown specifications, requirements tickets, or user stories.
- Incorporate
assertion-qualityinto CI: Run assertion auditing workflows on pull requests to catch tautological checks, missing assertions, and weak null-checks before they merge into production. - Leverage MTP Hot Reload in Local Loops: Use
dotnet runon MTP test projects to achieve sub-second test execution during iterative refactoring loops.















