본문으로 건너뛰기
Skillpedia
테스트5.8k · #14621

migrate-xunit-to-mstest

하는 일

이 스킬은 .NET 프로젝트의 xUnit.net 테스트를 테스트 동작을 바꾸지 않고 MSTest v4로 변환합니다. xUnit에서 MSTest로 옮기면서 같은 동작을 유지하려는 팀을 위한 스킬입니다.

사용하는 경우

  • ✓.NET 테스트 프로젝트가 xUnit을 쓰고 MSTest로 옮기고 싶을 때.
  • ✓xUnit 속성, 픽스처, 검증을 MSTest 대응 항목으로 바꾸고 싶을 때.
  • ✓xUnit을 MSTest로 바꾸는 작업이 이미 일부 되어 있어서 확인이 필요할 때.

스킬 링크

https://github.com/dotnet/skills/blob/main/plugins/dotnet-test-migration/skills/migrate-xunit-to-mstest/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/dotnet/skills/blob/main/plugins/dotnet-test-migration/skills/migrate-xunit-to-mstest/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 xUnit 테스트를 MSTest v4로 바꾸고, 같은 결과로 여전히 통과하는지 확인해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트가 xUnit 패키지와 속성을 찾고, 이를 MSTest 대응 항목으로 바꾼 뒤, 프로젝트를 빌드하고 테스트를 실행해 같은 결과인지 확인합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

xUnit -> MSTest Migration

Convert xUnit.net v2 or v3 tests to MSTest v4 without changing the target framework or test platform. A successful migration builds, discovers the same tests, and preserves pass/fail results and execution semantics.

Scope

Use this skill only when the project contains xUnit packages or source and the user wants MSTest. If the project already uses MSTest and contains no xUnit tests, report that no framework migration is needed and make no changes.

Do not combine this framework conversion with a target-framework upgrade or VSTest/MTP migration. Complete and verify one migration before starting another.

Workspace Contract

  • Continue after skill activation. Search the current working directory for the staged project and source; never look for user files under this skill's base directory.
  • Open the literal paths returned by glob/search. If one reader or patch tool rejects a path that was just found, retry with another available tool. Do not ask the user for a path until current-workspace discovery is exhausted.
  • Classify by the requested deliverable: "convert this project" means edit, build, and test; "give me a plan" or "how would I convert it?" means answer. Do not replace execution with "please provide the files" when files are present.
  • The final response must state the source xUnit version, preserved runner, changed files, each high-risk semantic mapping applied, and actual test counts. Assertions about fixture lifetime, Owner mapping, cancellation, or parallelization must be visible in the resulting source, not only prose.

Response Mode

  • Full migration request: inspect the project, make the edits, build, and run tests. Do not stop after giving a plan.
  • Focused compile error or API question: inspect the relevant code and apply only that mapping. Do not narrate the entire workflow.
  • Unsupported target framework: stop before changing packages. MSTest v4 requires .NET 8+ or .NET Framework 4.6.2+ for test applications; offer a separately approved TFM upgrade or MSTest v3 as the intermediate target.

Decisions That Change the Result

Apply these before the mechanical mapping:

Detected state Required action
No xUnit package, namespace, attribute, or fixture remains Stop. Make no file changes, report that migration is unnecessary, and run the existing dotnet test command once to prove the already-MSTest project is healthy.
Source uses VSTest Keep the existing VSTest property/configuration. Prefer retaining and updating a source project's explicit Microsoft.NET.Test.Sdk pin; a repository that intentionally relies on the MSTest metapackage's transitive dependency may keep that convention. Do not introduce MTP properties.
Source uses MTP Replace xUnit-specific MTP selection with MSTest MTP configuration. Prefer MSTest.Sdk; with the metapackage, set EnableMSTestRunner=true and OutputType=Exe. Preserve native-versus-bridged command integration, and do not add <UseVSTest>true</UseVSTest> or other VSTest-only configuration.
Source relies on xUnit's default parallelization Add [assembly: Parallelize(Workers = 0, Scope = ExecutionScope.ClassLevel)] to a compiled .cs file when the current project has at least two independently runnable test classes. In a one-class project with no explicit parallel setting, omit it because class-level concurrency is not observable. Translate explicit CollectionBehavior or xunit.runner.json settings regardless of current class count. Before reporting completion, read the changed file back and name it in the result.

For detailed mappings and examples, search references/mapping-cheatsheet.md for constructs actually present in the project and read only the matching sections. Do not load or reproduce the whole reference.

Fast Path

For a routine project migration, converge in four phases: one batched discovery read/search, one edit pass, one dotnet test, and one concise result. Do not:

  • list a directory and then reread the same files through another tool
  • copy project files into the loaded skill or its references/ directory; those files are read-only guidance, not an editing workspace
  • try dotnet test --no-restore unless restore is already known to be current
  • run separate restore, build, and test commands when dotnet test is sufficient
  • rerun a passing test command or inspect unchanged files for confirmation
자주 묻는 질문

대상 .NET 버전도 올리나요?

아니요. 대상 프레임워크 변경은 프레임워크 전환과 분리되어 있습니다.

같은 테스트 실행기를 유지하나요?

네. 프로젝트가 이미 쓰는 실행기를 그대로 유지합니다.

계획만 원하면 어떻게 하나요?

요청하면 계획을 답하고, 변경은 하지 않습니다.

상세 정보

작성자의 원본 설명

Convert .NET tests from xUnit.net v2/v3 to MSTest v4 while preserving VSTest or MTP. Use for replacing xunit packages, Fact/Theory/InlineData/MemberData, assertions, IClassFixture/ICollectionFixture, ITestOutputHelper, TestContext cancellation, traits/Owner, skips, timeouts, and xUnit parallelization. Also use when a "convert xUnit to MSTest" request may already be migrated: inspect and report the no-op. Do not use for xUnit v2-to-v3, MSTest upgrades, NUnit/TUnit conversion, or runner-only VSTest-to-MTP migration.

repo: dotnet/skills

인기도

GitHub 스타
5.8k
순위
#14621
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬