migrate-nunit-to-mstest
यह क्या करती है
यह स्किल .NET project के NUnit tests को MSTest v4 में बदलती है, जबकि test का व्यवहार वही रहता है। यह उन टीमों के लिए है जो बिना यह बदले कि tests क्या जाँचते हैं, अपना test framework MSTest पर ले जाना चाहती हैं।
कब इस्तेमाल करें
- ✓जब .NET test project NUnit इस्तेमाल करे और आप उसे MSTest पर बदलना चाहें।
- ✓जब आप NUnit attributes, assertions और setup methods की जगह MSTest के समकक्ष लगाना चाहें।
- ✓जब आप फ़ाइलें अभी संपादित किए बिना NUnit tests बदलने की योजना चाहें।
Skill का लिंक
https://github.com/dotnet/skills/blob/main/plugins/dotnet-test-migration/skills/migrate-nunit-to-mstest/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरे NUnit test project को MSTest v4 में बदलिए, और पक्का कीजिए कि वही tests अब भी चलें और पास हों।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट NUnit packages और attributes खोजता है, उन्हें MSTest समकक्षों में बदलता है, फिर project build करके और tests चलाकर वही परिणाम पक्का करता है।
तकनीकी सामग्री (मूल 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 testis sufficient. - Do not delete NUnit runner configuration until its behavior has been translated.
Workflow
1. Establish the baseline
- Batch-read test projects, central package files,
global.json,.runsettings,testconfig.json, and NUnit configuration. - Detect NUnit from
NUnit,NUnit3TestAdapter,NUnit.Analyzers,NUnit.Framework,NUnit.Framework.Legacy, andusing NUnit.Framework. - State whether the source is NUnit 3 or 4 from the resolved package version.
- Detect VSTest or MTP and preserve it. Use
platform-detectiononly when ambiguous. - Record target frameworks and stop if MSTest v4 does not support them.
- 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 version भी अपग्रेड करती है?
नहीं। target framework बदलना एक अलग चरण है और इस रूपांतरण का हिस्सा नहीं।
क्या वही tests अब भी मिलेंगे?
यही लक्ष्य है। स्किल जाँचती है कि रूपांतरण के बाद वही test cases मिलते हैं।
अगर मुझे सिर्फ़ योजना चाहिए तो?
स्किल योजना के साथ जवाब दे सकती है और कोई बदलाव नहीं करती।
जानकारी
लेखक का मूल विवरण
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
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
create-custom-agent
5.8kयह आपके एजेंट को VS Code के custom agent फ़ाइलें बनाने देती है, जिनके अपने tools, निर्देश और दूसरे agents को handoffs होते हैं।
create-skill
5.8kयह आपके एजेंट को सही नाम, साफ़ trigger विवरण और मानक के अनुसार SKILL.md फ़ाइल वाली नई agent skill बनाने में मदद करती है।
csharp-scripts
5.8kयह आपके एजेंट को .NET command line टूल से एक छोटा C# प्रोग्राम एकल फ़ाइल के रूप में चलाने देती है, पूरा प्रोजेक्ट बनाए बिना।
dotnet-pinvoke
5.8kयह आपके एजेंट को .NET से native C या C++ libraries सही तरीके से कॉल करने में मदद करती है, जिसमें signatures, string संभालना, memory और सुरक्षित handles शामिल हैं।
मिलती-जुलती skills
test-driven-development
311kयह आपके एजेंट को किसी भी फ़ीचर या सुधार से पहले पहले असफल होने वाला टेस्ट लिखना, उसे असफल होते देखना, फिर पास करने वाला सबसे छोटा कोड लिखना सिखाती है।
verification-before-completion
311kयह आपके एजेंट को किसी काम, सुधार या build के पूरा या पास होने का दावा करने से पहले असली जांच चलाकर उसका आउटपुट पढ़ना सिखाती है।
migrate-to-shoehorn
310kआपकी टेस्ट फ़ाइलों में जोखिम भरे type casts की जगह shoehorn लाइब्रेरी लगाती है, ताकि टेस्ट अधूरे डेटा से भी type checks पास कर सकें।