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

migrate-nunit-to-mstest

하는 일

이 스킬은 .NET 프로젝트의 NUnit 테스트를 테스트 동작을 유지하면서 MSTest v4로 변환합니다. 검사 내용을 바꾸지 않고 테스트 프레임워크를 MSTest로 옮기려는 팀을 위한 스킬입니다.

사용하는 경우

  • ✓.NET 테스트 프로젝트가 NUnit을 쓰고 MSTest로 바꾸고 싶을 때.
  • ✓NUnit 속성, 검증, 설정 메서드를 MSTest에 맞는 것으로 바꾸고 싶을 때.
  • ✓파일을 바꾸기 전에 NUnit 테스트 변환 계획만 먼저 보고 싶을 때.

스킬 링크

https://github.com/dotnet/skills/blob/main/plugins/dotnet-test-migration/skills/migrate-nunit-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-nunit-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에게 요청하는 예시

“제 NUnit 테스트 프로젝트를 MSTest v4로 변환해 주세요. 같은 테스트가 여전히 실행되고 통과하는지 확인해 주세요.”

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

작동 방식

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

기술 내용 (원본 SKILL.md)

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

NUnit -> MSTest Migration

Convert NUnit 3 or 4 tests to MSTest v4 without changing the target framework or test platform. A successful migration builds, discovers the same test cases, and preserves pass/fail, lifecycle, data, filtering, and concurrency semantics.

Scope

Use this skill only when the project contains NUnit packages or source and the user wants MSTest. If the project already uses MSTest and contains no NUnit 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

  • Search the current working directory for projects and source; never look for user files under this skill's directory.
  • Classify the deliverable: "convert this project" means edit, build, and test; "give me a plan" means answer without editing.
  • Preserve the user's requested project scope. Shared props may be changed only when they own NUnit package or runner configuration for that scope.
  • The final response must state the source NUnit version, preserved runner, changed files, high-risk semantic mappings, and actual test counts.

Response Mode

  • Full migration request: inspect, edit, build, and run tests. Do not stop after a plan.
  • Focused compile error or API question: apply only the relevant mapping.
  • 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.

Decisions That Change the Result

Detected state Required action
No NUnit package, namespace, attribute, or constraint remains Stop, make no changes, and run the existing test command once to prove the already-MSTest project is healthy.
Source uses VSTest Preserve VSTest. Retain and update an explicit Microsoft.NET.Test.Sdk pin when the repository owns one; do not introduce MTP properties.
Source uses MTP Replace NUnit-specific MTP configuration with MSTest MTP configuration. Prefer MSTest.Sdk; with the metapackage set EnableMSTestRunner=true and OutputType=Exe.
NUnit uses its default fixture lifecycle NUnit normally shares one fixture instance across all test cases; MSTest creates a new class instance per test. Move state that must remain class-shared behind static fields initialized by [ClassInitialize], or prove the state is per-test before leaving it as an instance field.
NUnit has no Parallelizable configuration Preserve serial execution. Do not add [assembly: Parallelize]; NUnit and MSTest are both serial by default.
NUnit explicitly enables parallel execution Translate the effective scope and worker count. Never infer method-level parallelism from fixture-level settings.

For detailed mappings, search references/mapping-cheatsheet.md for constructs present in the project and read only those sections.

Fast Path

For a routine migration, converge in four phases: one batched discovery pass, one edit pass, one dotnet test, and one concise result.

  • Use an existing CI/test result as the baseline when available.
  • Run a pre-edit baseline when counts are unavailable and the project contains parameterized tests, fixture state, namespace setup, retries, custom attributes, or explicit parallelization.
  • Do not run separate restore, build, and test commands when dotnet test is sufficient.
  • Do not delete NUnit runner configuration until its behavior has been translated.

Workflow

1. Establish the baseline

  1. Batch-read test projects, central package files, global.json, .runsettings, testconfig.json, and NUnit configuration.
  2. Detect NUnit from NUnit, NUnit3TestAdapter, NUnit.Analyzers, NUnit.Framework, NUnit.Framework.Legacy, and using NUnit.Framework.
  3. State whether the source is NUnit 3 or 4 from the resolved package version.
  4. Detect VSTest or MTP and preserve it. Use platform-detection only when ambiguous.
  5. Record target frameworks and stop if MSTest v4 does not support them.
  6. Inventory high-risk constructs:
    • [TestFixture(...)], [TestFixtureSource], [FixtureLifeCycle], constructors with parameters
    • [TestCase], [TestCaseSource], TestCaseData, [Values], [Range], [Random], [Sequential], [Pairwise], custom data attributes
    • [Theory], [Datapoint], `[Dat
자주 묻는 질문

.NET 버전도 올리나요?

아니요. 대상 프레임워크 변경은 이 변환과 별개의 단계이며 이 스킬에 포함되지 않습니다.

같은 테스트가 여전히 발견되나요?

그것이 목표입니다. 변환 후 같은 테스트 케이스가 발견되는지 확인합니다.

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

이 스킬은 변경 없이 계획만 답할 수 있습니다.

상세 정보

작성자의 원본 설명

Convert .NET tests from NUnit 3/4 to MSTest v4 while preserving VSTest or MTP. Use for replacing NUnit/NUnit3TestAdapter packages, Test/TestCase/ TestCaseSource/Values attributes, constraint assertions, SetUp/TearDown, OneTimeSetUp, SetUpFixture, FixtureLifeCycle, TestContext, categories, retries, timeouts, and NUnit parallelization. Also use when a "convert NUnit to MSTest" request may already be migrated: inspect and report the no-op. Do not use for NUnit version upgrades, xUnit/TUnit conversion, MSTest upgrades, or runner-only VSTest-to-MTP migration.

repo: dotnet/skills

인기도

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

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬