Migrate tests from MSTest to xUnit and clean up test infrastructure#193
Migrate tests from MSTest to xUnit and clean up test infrastructure#193
Conversation
Co-authored-by: gfs <98900+gfs@users.noreply.github.com>
Co-authored-by: gfs <98900+gfs@users.noreply.github.com>
|
@copilot try again please |
…ectedException, duplicate DataRows, add parallelization, use Assert.HasCount/IsEmpty/IsGreaterThan, add CancellationToken support. Update pipeline to use standard trx logger with results directory. Co-authored-by: gfs <98900+gfs@users.noreply.github.com>
Fixed all MSTest warnings in commit cca4e14. The changes include:
Build now succeeds with 0 warnings and 0 errors. |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This pull request addresses MSTest warnings in the test output and fixes the Azure DevOps pipeline test result handling. The changes modernize the test code to use newer MSTest 3.x assertion methods and configuration patterns, and ensure test results are properly published to the pipeline.
Changes:
- Fixed MSTest warnings (MSTEST0001, 0006, 0037, 0039, 0042, 0044, 0049) by replacing deprecated patterns with modern MSTest 3.x equivalents
- Updated Azure Pipelines YAML files to properly specify test result output location and format
- Added test parallelization configuration and cancellation token support for async tests
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| RecursiveExtractor.Tests/AssemblyInfo.cs | Added assembly-level Parallelize attribute for MSTEST0001 compliance |
| RecursiveExtractor.Tests/ExtractorTests/BaseExtractorTestClass.cs | Added TestContext property for MSTEST0049 compliance |
| RecursiveExtractor.Tests/ExtractorTests/CustomExtractorTests.cs | Added TestContext property; replaced Assert.AreEqual with Assert.HasCount/IsEmpty/IsGreaterThan for MSTEST0037 |
| RecursiveExtractor.Tests/ExtractorTests/DisposeBehaviorTests.cs | Replaced DataTestMethod with TestMethod; removed duplicate DataRow attributes; replaced Assert.ThrowsException with Assert.ThrowsExactly for MSTEST0044, 0042, 0039 |
| RecursiveExtractor.Tests/ExtractorTests/EncryptedArchiveTests.cs | Replaced DataTestMethod with TestMethod for MSTEST0044 |
| RecursiveExtractor.Tests/ExtractorTests/FilterTests.cs | Replaced DataTestMethod with TestMethod for MSTEST0044 |
| RecursiveExtractor.Tests/ExtractorTests/MiniMagicTests.cs | Replaced DataTestMethod with TestMethod for MSTEST0044 |
| RecursiveExtractor.Tests/ExtractorTests/MiscTests.cs | Added TestContext property; replaced DataTestMethod with TestMethod; replaced Assert.AreEqual with Assert.HasCount; added CancellationToken to ToListAsync calls for MSTEST0049, 0044, 0037 |
| RecursiveExtractor.Tests/ExtractorTests/TestQuinesAndSlip.cs | Replaced ExpectedException with Assert.ThrowsExactly/ThrowsExactlyAsync; added CancellationToken to ToListAsync calls for MSTEST0006, 0049 |
| RecursiveExtractor.Tests/ExtractorTests/TimeOutTests.cs | Replaced DataTestMethod with TestMethod; removed duplicate DataRow attributes; replaced Assert.ThrowsException with Assert.ThrowsExactly/ThrowsExactlyAsync for MSTEST0044, 0042, 0039 |
| RecursiveExtractor.Tests/SanitizePathTests.cs | Replaced DataTestMethod with TestMethod for MSTEST0044 |
| Pipelines/recursive-extractor-pr.yml | Updated dotnetTestArgs to properly specify TRX output location for test result publishing |
| Pipelines/recursive-extractor-release.yml | Updated dotnetTestArgs to properly specify TRX output location for test result publishing |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot this change breaks the PR gates - now see |
…sing error Co-authored-by: gfs <98900+gfs@users.noreply.github.com>
Fixed in bdfa42c. Reverted the pipeline |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@copilot I still see |
…ectory Co-authored-by: gfs <98900+gfs@users.noreply.github.com>
Fixed in 1e3c7b2. Changed the pipeline |
Co-authored-by: gfs <98900+gfs@users.noreply.github.com>
Fixed in 4543935. Removed
Updated the PR description in 4543935 to reflect the migration from MSTest to xUnit and cleanup changes. |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@copilot fix the code coverage report to be html format to be compatible with ado pipelines |
Co-authored-by: gfs <98900+gfs@users.noreply.github.com>
…ExtractToDirectory(string) and EnsureDisposedWithExtractToDirectoryAsync(string) with try-catch (DirectoryNotFoundException), matching the defensive pattern already used in TestPathHelpers.DeleteTestDirectory(). This makes the test cleanup resilient to the race with parallel test disposal.
Fixed in d91b6ce. Added a |
…microsoft/RecursiveExtractor into copilot/resolve-mstest-warnings
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Refactored test infrastructure to use a process-unique subdirectory for temporary test files, preventing cross-process interference. Introduced TestCleanupFixture with xUnit's IClassFixture for one-time-per-class cleanup, replacing per-test Dispose logic in BaseExtractorTestClass. Updated DeleteTestDirectory to only remove the process-specific directory.
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Switch ArchiveData and NoRecursionData to TheoryData<string, int> for improved type safety and xUnit integration. Simplify test case syntax, make ExtractorOptions fields readonly with new() initializers, and replace results.Count() with results.Count for clarity and efficiency.
Refactored ExtractArchive to be static and updated all calls. Replaced .ToArray() with C# 12 collection expressions for file lists. Switched AllowFilters and DenyFilters to use collection expressions. Removed unused static Logger field.
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@copilot add pubkishing code coverage to the pipeline (i.e. from # Publish code coverage results v2 Publish any of the code coverage results from a build.
|
Co-authored-by: gfs <98900+gfs@users.noreply.github.com>
Fixed in fcdff49. Added |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Migrates the test projects from MSTest to xUnit and updates the CI pipeline configuration.
Test Framework Migration (MSTest → xUnit)
[TestMethod]→[Fact],[DataRow]→[Theory]/[InlineData]/[MemberData]Pipeline Updates
dotnetTestArgsto use--settings coverlet.runsettings --collect:"XPlat Code Coverage"coverlet.runsettingsfile to configure coverage output format (cobertura,opencover) for ADO pipeline compatibilityPublishCodeCoverageResults@2task viapostTestparameter to publish code coverage results to Azure DevOpsCode Cleanup
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.