mirror of
https://github.com/dotnet/skills.git
synced 2026-09-20 09:49:54 +08:00
0f31228b58
* Fix evaluation timeouts and improve prompts for dotnet-test skills
- writing-mstest-tests: increase global vally timeout from 3m to 5m to match
the 300s eval.yaml timeout for the complex 'Modernize legacy test patterns' stimulus
- code-testing-agent: increase timeout from 40m/2400s to 60m/3600s
- mtp-hot-reload: increase timeout from 6m to 10m and remove overly strict
expect_tools constraint on launchSettings stimulus
- migrate-mstest-v1v2-to-v3: rephrase prompt for assertion overload errors to
mention CS1501 and cover AreNotEqual/AreSame alongside AreEqual
* Increase eval timeouts for mtp-hot-reload and migrate-mstest-v1v2-to-v3 scenarios
* Strengthen activation prompts and add missing vally scenarios
- migrate-mstest-v1v2-to-v3: Add explicit 'MSTest v2 to v3' migration
language in .testsettings and DataRow prompts (both eval.yaml and
eval.vally.yaml)
- writing-mstest-tests: Add 'MSTest' keyword and skill-specific
terminology to all prompts that lacked activation signal
- writing-mstest-tests: Add 5 missing vally scenarios (string
assertions, comparison assertions, collection/null/reference
assertions, conditional execution, parallelization)
- Add service-registry fixture files for the collection assertions
scenario
* Improve skill activation via SKILL.md descriptions and prompt alignment
Three-pronged fix for systematic NOT ACTIVATED failures:
1. SKILL.md descriptions: Restructure writing-mstest-tests, migrate-
mstest-v1v2-to-v3, and code-testing-agent descriptions to use the
proven 'Use when user says' pattern with quoted trigger phrases
(matching the working run-tests pattern)
2. Vally prompts: Each prompt now contains at least one exact quoted
trigger phrase from its SKILL.md description to ensure strong
description-to-prompt matching
3. Specific fixes:
- writing-mstest-tests: All 15 prompts now include MSTest-specific
trigger phrases (Assert.ThrowsExactly, sealed test class, DataRow,
DynamicData, Assert.HasCount, Assert.IsInstanceOfType, etc.)
- migrate-mstest-v1v2-to-v3: Add '.NET 5 dropped' and 'framework
compatibility issues' to trigger phrases; strengthen dropped-TFM
prompt
- code-testing-agent: Add 'generate comprehensive unit tests' and
'achieve high code coverage' to trigger phrases
* Revert SKILL.md description changes that caused activation regression
The description restructuring in 67056d8ec broke skill activation:
- migrate-mstest-v1v2-to-v3: went from 6/9 activating to 0/9
- writing-mstest-tests: lost isolated activation
- code-testing-agent: unnecessary change to working description
Restore all three SKILL.md files to their pre-regression state.
Keep the vally prompt improvements from 259727e.
* Fix writing-mstest-tests plugin-mode activation
- Add MSTest carve-out to code-testing-agent DO NOT USE FOR to prevent
it from intercepting MSTest-specific prompts
- Add test parallelization/MSTest.Sdk keywords to writing-mstest-tests
description (scenario 15 failed even in isolated mode)
- Strengthen prompts to be more MSTest-specific:
- Scenario 1: emphasize MSTest patterns over generic 'write tests'
- Scenario 4: remove vague 'something seems off', directly ask to
fix swapped Assert.AreEqual arguments
- Scenario 5: reframe as modernization request with specific APIs
- Scenario 13: name specific MSTest assertion APIs in the prompt
* Fix writing-mstest-tests description over 1024 char limit
Shorten the USE FOR section by removing redundant 'help me write
comprehensive tests' and condensing the assertion API list.
Description is now 944 chars (limit: 1024).
* Increase vally job timeout from 60m to 180m
The code-testing-agent eval has a 60m per-stimulus timeout, and vally
runs multiple configurations (baseline, isolated, plugin). The 60m
job-level timeout was causing the job to be cancelled mid-evaluation.
Match the 180m timeout from the evaluate job in evaluation.yml.
* Address PR review comments
- Add IsPackable=false to writing-mstest-tests fixture csproj for
consistency with other dotnet-test fixture projects
- Fix grammar in migrate-mstest-v1v2-to-v3 eval prompts: add comma
after 'upgrade' and add 'file' for clarity (both eval.yaml and
eval.vally.yaml)
* Trim dotnet-test aggregate description size under 15,000 limit
Consolidate duplicate filter keyword mentions in migrate-vstest-to-mtp
and shorten the cross-reference in migrate-xunit-to-xunit-v3 while
keeping the --filter-class/--filter-trait/--filter-query trigger
keywords for skill activation.
* Fix vally skill activation for 9 failing eval scenarios
Improve eval.vally.yaml prompts that were too specific, causing the model
to answer from general knowledge without activating the skill:
- migrate-mstest-v1v2-to-v3: Remove leading question that gives away the
answer ('Is .NET 5 dropped?'); use multi-target fixture matching eval.yaml
- writing-mstest-tests (7 scenarios): Add 'following MSTest best practices'
to trigger skill reading; make prompts more open-ended (don't name exact
APIs like OSCondition, Assert.AreSame); match eval.yaml prompt style
- code-testing-agent: Clarify app complexity to encourage skill pipeline
The pattern: vally prompts that give away exact API names or answers let
the model skip reading the skill. More open-ended prompts referencing
'best practices' trigger skill activation.
* Improve skills and eval prompts for regression scenarios
migrate-xunit-to-xunit-v3 SKILL.md:
- Restructure from 16 steps to 13, merging redundant steps
- Move test platform selection from step 12 to step 4
- Mark steps 6-12 as conditional with prioritization note
- Remove external URL references that caused web_fetch detours
writing-mstest-tests SKILL.md:
- Add Response Guidelines for proportional responses
- Remove redundant Validation checklist and Common Pitfalls table
(all items already covered in workflow steps)
- Reduces token count from 3,305 to 2,944
migrate-mstest-v1v2-to-v3 eval.vally.yaml:
- Relax DataRow rubric to account for MSTest 3.8.0 fixing the
16-parameter constructor limit
writing-mstest-tests eval.vally.yaml:
- Make 3 prompts more open-ended by removing API name hints
(Assert.HasCount, Assert.StartsWith, DynamicData to ValueTuples)
so baseline model cannot answer confidently without the skill
505 lines
20 KiB
YAML
505 lines
20 KiB
YAML
scenarios:
|
|
# ============================================================================
|
|
# Goal 1: Suggesting hot reload setup for MTP projects
|
|
# ============================================================================
|
|
|
|
- name: "Suggest hot reload for failing test in MTP project (SDK 9)"
|
|
prompt: "I have a failing test in ProcessPayment_NegativeAmount_ThrowsException and I want to iterate on the fix quickly without rebuilding each time. What's the fastest workflow?"
|
|
setup:
|
|
files:
|
|
- path: "TestProject.csproj"
|
|
content: |
|
|
<Project Sdk="Microsoft.NET.Sdk">
|
|
<PropertyGroup>
|
|
<TargetFramework>net9.0</TargetFramework>
|
|
<IsPackable>false</IsPackable>
|
|
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
|
|
</PropertyGroup>
|
|
<ItemGroup>
|
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
|
|
<PackageReference Include="MSTest" Version="3.8.0" />
|
|
</ItemGroup>
|
|
</Project>
|
|
- path: "PaymentProcessorTests.cs"
|
|
content: |
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
namespace Contoso.Payments.Tests;
|
|
|
|
[TestClass]
|
|
public class PaymentProcessorTests
|
|
{
|
|
[TestMethod]
|
|
public void ProcessPayment_ValidAmount_Succeeds()
|
|
{
|
|
var result = ProcessPayment(100.00m);
|
|
Assert.IsTrue(result);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void ProcessPayment_ZeroAmount_ThrowsException()
|
|
{
|
|
Assert.ThrowsException<ArgumentException>(() => ProcessPayment(0));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void ProcessPayment_NegativeAmount_ThrowsException()
|
|
{
|
|
// BUG: This test is failing because ProcessPayment doesn't validate negative amounts
|
|
Assert.ThrowsException<ArgumentException>(() => ProcessPayment(-50.00m));
|
|
}
|
|
|
|
private static bool ProcessPayment(decimal amount)
|
|
{
|
|
if (amount == 0) throw new ArgumentException("Amount cannot be zero");
|
|
// Missing: validation for negative amounts
|
|
return true;
|
|
}
|
|
}
|
|
- path: "global.json"
|
|
content: |
|
|
{
|
|
"sdk": {
|
|
"version": "9.0.200",
|
|
"rollForward": "latestFeature"
|
|
}
|
|
}
|
|
assertions:
|
|
- type: "output_matches"
|
|
pattern: "Microsoft\\.Testing\\.Extensions\\.HotReload"
|
|
- type: "output_matches"
|
|
pattern: "TESTINGPLATFORM_HOTRELOAD_ENABLED"
|
|
- type: "output_matches"
|
|
pattern: "dotnet run"
|
|
rubric:
|
|
- "Detects this is an MTP project (TestingPlatformDotnetTestSupport=true in csproj)"
|
|
- "Suggests installing the Microsoft.Testing.Extensions.HotReload NuGet package"
|
|
- "Instructs setting TESTINGPLATFORM_HOTRELOAD_ENABLED=1 environment variable"
|
|
- "Uses 'dotnet run --project' to run the test host, not 'dotnet test'"
|
|
- "Explains the iterative workflow: edit code, hot reload picks up changes, re-runs tests"
|
|
timeout: 300
|
|
|
|
- name: "Suggest hot reload for failing test in MTP project (SDK 10)"
|
|
prompt: "My RemoveStock_ExceedsAvailable_ThrowsException test is failing. I want to iterate fixes rapidly. How can I set up hot reload for this test project?"
|
|
setup:
|
|
files:
|
|
- path: "TestProject.csproj"
|
|
content: |
|
|
<Project Sdk="Microsoft.NET.Sdk">
|
|
<PropertyGroup>
|
|
<TargetFramework>net10.0</TargetFramework>
|
|
<IsPackable>false</IsPackable>
|
|
</PropertyGroup>
|
|
<ItemGroup>
|
|
<PackageReference Include="MSTest" Version="3.8.0" />
|
|
</ItemGroup>
|
|
</Project>
|
|
- path: "InventoryServiceTests.cs"
|
|
content: |
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
namespace Contoso.Inventory.Tests;
|
|
|
|
[TestClass]
|
|
public class InventoryServiceTests
|
|
{
|
|
[TestMethod]
|
|
public void AddStock_ValidQuantity_IncreasesCount()
|
|
{
|
|
var service = new InventoryService();
|
|
service.AddStock("SKU-001", 10);
|
|
Assert.AreEqual(10, service.GetStock("SKU-001"));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void RemoveStock_ExceedsAvailable_ThrowsException()
|
|
{
|
|
var service = new InventoryService();
|
|
service.AddStock("SKU-001", 5);
|
|
Assert.ThrowsException<InvalidOperationException>(() => service.RemoveStock("SKU-001", 10));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void GetStock_UnknownSku_ReturnsZero()
|
|
{
|
|
var service = new InventoryService();
|
|
Assert.AreEqual(0, service.GetStock("UNKNOWN"));
|
|
}
|
|
}
|
|
|
|
public class InventoryService
|
|
{
|
|
private readonly Dictionary<string, int> _stock = new();
|
|
public void AddStock(string sku, int quantity) =>
|
|
_stock[sku] = _stock.GetValueOrDefault(sku) + quantity;
|
|
public void RemoveStock(string sku, int quantity) =>
|
|
_stock[sku] = _stock.GetValueOrDefault(sku) - quantity;
|
|
public int GetStock(string sku) =>
|
|
_stock.GetValueOrDefault(sku);
|
|
}
|
|
- path: "global.json"
|
|
content: |
|
|
{
|
|
"sdk": {
|
|
"version": "10.0.100"
|
|
},
|
|
"test": {
|
|
"runner": "Microsoft.Testing.Platform"
|
|
}
|
|
}
|
|
assertions:
|
|
- type: "output_matches"
|
|
pattern: "Microsoft\\.Testing\\.Extensions\\.HotReload"
|
|
- type: "output_matches"
|
|
pattern: "TESTINGPLATFORM_HOTRELOAD_ENABLED"
|
|
- type: "output_matches"
|
|
pattern: "dotnet run"
|
|
rubric:
|
|
- "Detects MTP via global.json runner setting (Microsoft.Testing.Platform) on SDK 10"
|
|
- "Suggests installing the Microsoft.Testing.Extensions.HotReload NuGet package"
|
|
- "Instructs setting TESTINGPLATFORM_HOTRELOAD_ENABLED=1"
|
|
- "Uses 'dotnet run' to start the test host in console mode"
|
|
- "Mentions that hot reload works in console mode only, not Test Explorer"
|
|
timeout: 120
|
|
|
|
# ============================================================================
|
|
# Goal 2: Using hot reload when package is already installed
|
|
# ============================================================================
|
|
|
|
- name: "Enable hot reload when package already installed"
|
|
prompt: "I have a test project with some failing tests. I see Microsoft.Testing.Extensions.HotReload is already in the project. How do I use it to quickly iterate on fixes?"
|
|
setup:
|
|
files:
|
|
- path: "TestProject.csproj"
|
|
content: |
|
|
<Project Sdk="Microsoft.NET.Sdk">
|
|
<PropertyGroup>
|
|
<TargetFramework>net9.0</TargetFramework>
|
|
<IsPackable>false</IsPackable>
|
|
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
|
|
</PropertyGroup>
|
|
<ItemGroup>
|
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
|
|
<PackageReference Include="MSTest" Version="3.8.0" />
|
|
<PackageReference Include="Microsoft.Testing.Extensions.HotReload" Version="1.5.3" />
|
|
</ItemGroup>
|
|
</Project>
|
|
- path: "EmailValidatorTests.cs"
|
|
content: |
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
namespace Contoso.Validation.Tests;
|
|
|
|
[TestClass]
|
|
public class EmailValidatorTests
|
|
{
|
|
[TestMethod]
|
|
public void Validate_ValidEmail_ReturnsTrue()
|
|
{
|
|
Assert.IsTrue(IsValidEmail("user@example.com"));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void Validate_MissingAtSign_ReturnsFalse()
|
|
{
|
|
Assert.IsFalse(IsValidEmail("userexample.com"));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void Validate_EmptyString_ReturnsFalse()
|
|
{
|
|
Assert.IsFalse(IsValidEmail(""));
|
|
}
|
|
|
|
private static bool IsValidEmail(string email)
|
|
{
|
|
return !string.IsNullOrEmpty(email);
|
|
}
|
|
}
|
|
- path: "global.json"
|
|
content: |
|
|
{
|
|
"sdk": {
|
|
"version": "9.0.200",
|
|
"rollForward": "latestFeature"
|
|
}
|
|
}
|
|
assertions:
|
|
- type: "output_matches"
|
|
pattern: "TESTINGPLATFORM_HOTRELOAD_ENABLED"
|
|
- type: "output_matches"
|
|
pattern: "dotnet run"
|
|
- type: "output_not_matches"
|
|
pattern: "dotnet add.*package.*HotReload"
|
|
rubric:
|
|
- "Recognizes that Microsoft.Testing.Extensions.HotReload is already installed"
|
|
- "Does NOT suggest installing the package again"
|
|
- "Instructs setting TESTINGPLATFORM_HOTRELOAD_ENABLED=1 to activate hot reload"
|
|
- "Uses 'dotnet run --project' to run in console mode"
|
|
- "Describes the iterative workflow: make changes, tests re-run automatically"
|
|
timeout: 300
|
|
|
|
- name: "Suggest launchSettings.json configuration for hot reload"
|
|
prompt: "I want to set up hot reload for my test project so it's always enabled when I run from the command line. I don't want to set the environment variable every time."
|
|
setup:
|
|
files:
|
|
- path: "TestProject.csproj"
|
|
content: |
|
|
<Project Sdk="Microsoft.NET.Sdk">
|
|
<PropertyGroup>
|
|
<TargetFramework>net9.0</TargetFramework>
|
|
<IsPackable>false</IsPackable>
|
|
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
|
|
</PropertyGroup>
|
|
<ItemGroup>
|
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
|
|
<PackageReference Include="MSTest" Version="3.8.0" />
|
|
</ItemGroup>
|
|
</Project>
|
|
- path: "PaymentProcessorTests.cs"
|
|
content: |
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
namespace Contoso.Payments.Tests;
|
|
|
|
[TestClass]
|
|
public class PaymentProcessorTests
|
|
{
|
|
[TestMethod]
|
|
public void ProcessPayment_ValidAmount_Succeeds()
|
|
{
|
|
Assert.IsTrue(true);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void ProcessPayment_NegativeAmount_ThrowsException()
|
|
{
|
|
Assert.ThrowsException<ArgumentException>(() => throw new InvalidOperationException());
|
|
}
|
|
}
|
|
- path: "global.json"
|
|
content: |
|
|
{
|
|
"sdk": {
|
|
"version": "9.0.200",
|
|
"rollForward": "latestFeature"
|
|
}
|
|
}
|
|
assertions:
|
|
- type: "output_matches"
|
|
pattern: "launchSettings\\.json"
|
|
- type: "output_matches"
|
|
pattern: "TESTINGPLATFORM_HOTRELOAD_ENABLED"
|
|
- type: "output_matches"
|
|
pattern: "Microsoft\\.Testing\\.Extensions\\.HotReload"
|
|
rubric:
|
|
- "Suggests creating or updating Properties/launchSettings.json"
|
|
- "Shows the correct launchSettings.json structure with TESTINGPLATFORM_HOTRELOAD_ENABLED=1"
|
|
- "Includes the Microsoft.Testing.Extensions.HotReload package installation step"
|
|
- "Explains that launchSettings.json makes the setting persistent across runs"
|
|
timeout: 300
|
|
|
|
# ============================================================================
|
|
# Goal 3: Correct usage — dotnet run, not dotnet test
|
|
# ============================================================================
|
|
|
|
- name: "Use dotnet run not dotnet test for hot reload"
|
|
prompt: "I installed the hot reload package and set the environment variable. Should I use 'dotnet test' or 'dotnet run' to benefit from hot reload?"
|
|
setup:
|
|
files:
|
|
- path: "TestProject.csproj"
|
|
content: |
|
|
<Project Sdk="Microsoft.NET.Sdk">
|
|
<PropertyGroup>
|
|
<TargetFramework>net9.0</TargetFramework>
|
|
<IsPackable>false</IsPackable>
|
|
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
|
|
</PropertyGroup>
|
|
<ItemGroup>
|
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
|
|
<PackageReference Include="MSTest" Version="3.8.0" />
|
|
<PackageReference Include="Microsoft.Testing.Extensions.HotReload" Version="1.5.3" />
|
|
</ItemGroup>
|
|
</Project>
|
|
- path: "EmailValidatorTests.cs"
|
|
content: |
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
namespace Contoso.Validation.Tests;
|
|
|
|
[TestClass]
|
|
public class EmailValidatorTests
|
|
{
|
|
[TestMethod]
|
|
public void Validate_ValidEmail_ReturnsTrue()
|
|
{
|
|
Assert.IsTrue(IsValidEmail("user@example.com"));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void Validate_MissingAtSign_ReturnsFalse()
|
|
{
|
|
Assert.IsFalse(IsValidEmail("userexample.com"));
|
|
}
|
|
|
|
private static bool IsValidEmail(string email)
|
|
{
|
|
return !string.IsNullOrEmpty(email);
|
|
}
|
|
}
|
|
- path: "global.json"
|
|
content: |
|
|
{
|
|
"sdk": {
|
|
"version": "9.0.200",
|
|
"rollForward": "latestFeature"
|
|
}
|
|
}
|
|
assertions:
|
|
- type: "output_matches"
|
|
pattern: "dotnet run"
|
|
- type: "output_matches"
|
|
pattern: "console mode"
|
|
rubric:
|
|
- "Clearly states that 'dotnet run' must be used, not 'dotnet test'"
|
|
- "Explains that hot reload works in console mode only"
|
|
- "Mentions there is no Test Explorer support for MTP hot reload"
|
|
- "Shows the correct command: dotnet run --project <path>"
|
|
expect_tools: ["bash"]
|
|
timeout: 180
|
|
|
|
# ============================================================================
|
|
# Goal 4: Negative — VSTest project cannot use MTP hot reload
|
|
# ============================================================================
|
|
|
|
- name: "Negative: VSTest project cannot use MTP hot reload"
|
|
prompt: "I have some failing tests and want to use hot reload to iterate faster. Can you set it up for me?"
|
|
setup:
|
|
files:
|
|
- path: "TestProject.csproj"
|
|
content: |
|
|
<Project Sdk="Microsoft.NET.Sdk">
|
|
<PropertyGroup>
|
|
<TargetFramework>net8.0</TargetFramework>
|
|
<IsPackable>false</IsPackable>
|
|
</PropertyGroup>
|
|
<ItemGroup>
|
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
|
|
<PackageReference Include="MSTest.TestAdapter" Version="3.6.3" />
|
|
<PackageReference Include="MSTest.TestFramework" Version="3.6.3" />
|
|
</ItemGroup>
|
|
</Project>
|
|
- path: "ShippingCalculatorTests.cs"
|
|
content: |
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
namespace Contoso.Shipping.Tests;
|
|
|
|
[TestClass]
|
|
public class ShippingCalculatorTests
|
|
{
|
|
[TestMethod]
|
|
public void CalculateShipping_StandardDelivery_Returns5()
|
|
{
|
|
Assert.AreEqual(5.00m, CalculateShipping("standard", 1.0));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void CalculateShipping_ExpressDelivery_Returns15()
|
|
{
|
|
Assert.AreEqual(15.00m, CalculateShipping("express", 1.0));
|
|
}
|
|
|
|
private static decimal CalculateShipping(string method, double weightKg)
|
|
{
|
|
return method switch
|
|
{
|
|
"standard" => 5.00m,
|
|
"express" => 10.00m,
|
|
_ => throw new ArgumentException("Unknown shipping method")
|
|
};
|
|
}
|
|
}
|
|
assertions:
|
|
- type: "output_matches"
|
|
pattern: "(VSTest|not.*MTP|not.*Microsoft\\.Testing\\.Platform|migrate|upgrade)"
|
|
- type: "output_not_matches"
|
|
pattern: "TESTINGPLATFORM_HOTRELOAD_ENABLED"
|
|
rubric:
|
|
- "Detects the project uses VSTest (Microsoft.NET.Test.Sdk + MSTest.TestAdapter, no MTP signals)"
|
|
- "Explains that MTP hot reload is NOT available for VSTest projects"
|
|
- "Does NOT suggest setting TESTINGPLATFORM_HOTRELOAD_ENABLED for a VSTest project"
|
|
- "Suggests either migrating to MTP or using Visual Studio Test Explorer hot reload as alternatives"
|
|
timeout: 240
|
|
|
|
# ============================================================================
|
|
# Goal 5: Filtering tests with hot reload
|
|
# ============================================================================
|
|
|
|
- name: "Run specific failing test with hot reload filter"
|
|
prompt: "I only want to hot-reload iterate on the ProcessPayment_NegativeAmount_ThrowsException test. How do I filter to just that test while using hot reload?"
|
|
setup:
|
|
files:
|
|
- path: "TestProject.csproj"
|
|
content: |
|
|
<Project Sdk="Microsoft.NET.Sdk">
|
|
<PropertyGroup>
|
|
<TargetFramework>net9.0</TargetFramework>
|
|
<IsPackable>false</IsPackable>
|
|
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
|
|
</PropertyGroup>
|
|
<ItemGroup>
|
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
|
|
<PackageReference Include="MSTest" Version="3.8.0" />
|
|
</ItemGroup>
|
|
</Project>
|
|
- path: "PaymentProcessorTests.cs"
|
|
content: |
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
namespace Contoso.Payments.Tests;
|
|
|
|
[TestClass]
|
|
public class PaymentProcessorTests
|
|
{
|
|
[TestMethod]
|
|
public void ProcessPayment_ValidAmount_Succeeds()
|
|
{
|
|
var result = ProcessPayment(100.00m);
|
|
Assert.IsTrue(result);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void ProcessPayment_ZeroAmount_ThrowsException()
|
|
{
|
|
Assert.ThrowsException<ArgumentException>(() => ProcessPayment(0));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void ProcessPayment_NegativeAmount_ThrowsException()
|
|
{
|
|
Assert.ThrowsException<ArgumentException>(() => ProcessPayment(-50.00m));
|
|
}
|
|
|
|
private static bool ProcessPayment(decimal amount)
|
|
{
|
|
if (amount == 0) throw new ArgumentException("Amount cannot be zero");
|
|
return true;
|
|
}
|
|
}
|
|
- path: "global.json"
|
|
content: |
|
|
{
|
|
"sdk": {
|
|
"version": "9.0.200",
|
|
"rollForward": "latestFeature"
|
|
}
|
|
}
|
|
assertions:
|
|
- type: "output_matches"
|
|
pattern: "dotnet run"
|
|
- type: "output_matches"
|
|
pattern: "--filter"
|
|
- type: "output_matches"
|
|
pattern: "ProcessPayment_NegativeAmount"
|
|
rubric:
|
|
- "Uses 'dotnet run --project <path>' with filter arguments after '--'"
|
|
- "Applies the correct MSTest filter syntax for the specific test name"
|
|
- "Includes the TESTINGPLATFORM_HOTRELOAD_ENABLED environment variable setup"
|
|
- "Shows how to pass the filter: dotnet run --project <path> -- --filter FullyQualifiedName~ProcessPayment_NegativeAmount"
|
|
expect_tools: ["bash"]
|
|
timeout: 300
|