You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds 3 missing test cases for MSTEST0077 (SharedFileSystemPathInTestAnalyzer) covering mutation operations that were not previously exercised: File.Delete, Directory.Delete, and Directory.Move.
The analyzer has complex per-method path-role logic: Copy only flags the destination, Move flags both source and destination (both are mutations), Replace flags the destination and backup. The Delete paths for both File and Directory were conspicuously missing from the test suite — tests only covered CreateDirectory, Copy, Move (for File), Replace, OpenWrite, and WriteAllText variants.
Approach
Added 3 [TestMethod] tests to SharedFileSystemPathInTestAnalyzerTests:
WhenTestMethodDeletesFileWithConstantPath_Diagnostic — File.Delete("shared.txt") in a parallelized test class should be flagged.
WhenTestMethodDeletesDirectoryWithConstantPath_Diagnostic — Directory.Delete("shared-dir") should be flagged.
WhenTestMethodMovesDirectory_BothSourceAndDestAreDiagnostic — Directory.Move("source-dir", "dest-dir") should be flagged; both paths are mutated (source is removed, destination is created), and the analyzer reports the first constant mutated path found.
Test Status
✅ Build succeeded, all 21 SharedFileSystemPath tests pass (0 failures).
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
southcentralus0.in.applicationinsights.azure.com
To allow these domains, add them to the network.allowed list in your workflow frontmatter:
🤖 Automated content by GitHub Copilot. Generated by the Test Improver workflow. · sonnet46 176.5 AIC · ⌖ 15 AIC · ⊞ 13.6K · [◷]( · ◷) Comment /test-assist to run again
Add this agentic workflow to your repo
To install this agentic workflow, run
gh aw add githubnext/agentics/workflows/test-improver.md@main
Note
This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch test-assist/shared-filesystem-delete-tests-4ec1c826fe306fe3.
To fix the permissions issue, go to Settings → Actions → General and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ
Show patch preview (119 of 119 lines)
From bf6e2437485098b02d01bc0958a969adf624b260 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Tue, 28 Jul 2026 23:25:21 +0000
Subject: [PATCH] test: add edge-case tests for
SharedFileSystemPathInTestAnalyzer delete/move operations
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add 3 new tests for MSTEST0077 covering previously untested mutation operations:
- File.Delete with constant path → Diagnostic- Directory.Delete with constant path → Diagnostic- Directory.Move with constant source and destination → Diagnostic (first mutated path arg reported)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
...SharedFileSystemPathInTestAnalyzerTests.cs | 87 +++++++++++++++++++
1 file changed, 87 insertions(+)
diff --git a/test/UnitTests/MSTest.Analyzers.UnitTests/SharedFileSystemPathInTestAnalyzerTests.cs b/test/UnitTests/MSTest.Analyzers.UnitTests/SharedFileSystemPathInTestAnalyzerTests.cs
index def0bb2..ab381cf 100644
--- a/test/UnitTests/MSTest.Analyzers.UnitTests/SharedFileSystemPathInTestAnalyzerTests.cs+++ b/test/UnitTests/MSTest.Analyzers.UnitTests/SharedFileSystemPathInTestAnalyzerTests.cs@@ -493,4 +493,91 @@ await VerifyCS.VerifyAnalyzerAsync(
.WithLocation(0)
.WithArguments("setup.txt"));
}
++ [TestMethod]+ public async Task WhenTestMethodDeletesFileWithConstantPath_Diagnostic()+ {+ // File.Delete is a mutating operation: removing a shared file by constant path+ // is a race condition under method-level parallelization.+ string code = """+ using System.IO;+ using Microsoft.VisualStudio.TestTools.UnitTesting;++ [assembly: Parallelize(Workers = 0, Scope = ExecutionScope.MethodLevel)]++ [TestClass]+ public class MyTestClass+ {+ [TestMethod]+ public void MyTest
... (truncated)
Goal and Rationale
Adds 3 missing test cases for MSTEST0077 (
SharedFileSystemPathInTestAnalyzer) covering mutation operations that were not previously exercised:File.Delete,Directory.Delete, andDirectory.Move.The analyzer has complex per-method path-role logic:
Copyonly flags the destination,Moveflags both source and destination (both are mutations),Replaceflags the destination and backup. TheDeletepaths for bothFileandDirectorywere conspicuously missing from the test suite — tests only coveredCreateDirectory,Copy,Move(forFile),Replace,OpenWrite, andWriteAllTextvariants.Approach
Added 3
[TestMethod]tests toSharedFileSystemPathInTestAnalyzerTests:WhenTestMethodDeletesFileWithConstantPath_Diagnostic—File.Delete("shared.txt")in a parallelized test class should be flagged.WhenTestMethodDeletesDirectoryWithConstantPath_Diagnostic—Directory.Delete("shared-dir")should be flagged.WhenTestMethodMovesDirectory_BothSourceAndDestAreDiagnostic—Directory.Move("source-dir", "dest-dir")should be flagged; both paths are mutated (source is removed, destination is created), and the analyzer reports the first constant mutated path found.Test Status
✅ Build succeeded, all 21
SharedFileSystemPathtests pass (0 failures).Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
southcentralus0.in.applicationinsights.azure.comSee Network Configuration for more information.
Add this agentic workflow to your repo
To install this agentic workflow, run
Note
This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch
test-assist/shared-filesystem-delete-tests-4ec1c826fe306fe3.Click here to create the pull request
To fix the permissions issue, go to Settings → Actions → General and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ
Show patch preview (119 of 119 lines)