migrate-xunit-to-xunit-v3
यह क्या करती है
यह स्किल .NET test projects को xUnit.net v2 से xunit.v3 पर अपग्रेड करती है, जो xUnit test library का नया वर्ज़न है। यह उन टीमों के लिए है जिनके tests v3 पर जाने के बाद compile नहीं होते या अलग व्यवहार करते हैं।
कब इस्तेमाल करें
- ✓जब test project xunit v2 packages का संदर्भ दे और उसे xunit.v3 पर जाना चाहिए।
- ✓जब xunit packages को version 3 पर अपडेट करने के बाद compile errors आएँ।
- ✓जब अपग्रेड के बाद custom test attributes या async tests टूटें।
Skill का लिंक
https://github.com/dotnet/skills/blob/main/plugins/dotnet-test-migration/skills/migrate-xunit-to-xunit-v3/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरे xUnit v2 test projects को xunit.v3 पर अपग्रेड कीजिए और जो भी build होने से रोके उसे ठीक कीजिए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट package references और project सेटिंग्स अपडेट करता है, v3 के लिए ज़रूरी source बदलाव ठीक करता है, और यह जाँचने के लिए tests चलाता है कि परिणाम मेल खाते हैं।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
xunit.v3 Migration
Migrate .NET test projects from xUnit.net v2 to xUnit.net v3. The outcome is a solution where all test projects reference xunit.v3.* packages, compiles cleanly, and all tests pass with the same results as before migration.
When to Use
- Upgrading test projects from
xunit(v2) packages toxunit.v3 - Resolving compilation errors after updating xunit package references to v3
When Not to Use
- Migrating between test frameworks (e.g., MSTest or NUnit to xUnit.net) — different effort entirely
- Migrating from VSTest to Microsoft.Testing.Platform — use
migrate-vstest-to-mtp - The projects already reference
xunit.v3— migration is done
Inputs
| Input | Required | Description |
|---|---|---|
| Test project or solution | No | Discover .csproj, .sln, .slnx, central props, and source in the current working directory; ask only if none are found or the target is ambiguous |
Workspace and Completion Contract
- Skill activation is not completion. For migrate/fix/update requests, inspect the staged files, edit them, and run tests in the same task.
- The skill base directory contains only guidance. Search the current working directory and open paths exactly as returned.
- If a tool rejects a searched path, classify the rejection before retrying. Only a positively confirmed reader/path-normalization limitation with authorized access permits retrying through another permitted reader/editor.
- On a permission, policy, or content-exclusion denial, stop that path and report the blocker. Never bypass the denial through other tools, shell commands, aliases, or agents, or infer or reconstruct the restricted content.
- If the rejection reason is unclear, treat the path as unavailable, not missing. Continue only independently permitted work and explicitly disclose the incomplete migration.
- Do not ask the user to provide a path while workspace discovery can find it.
- Inventory project/central package files and all affected source in one pass. A package-only migration is incomplete when v2-only APIs remain.
- End with the detected source version and runner, exact package compatibility set, files changed, discovered/passed/failed/skipped counts, and any platform-specific result. A build without test discovery is not success.
- Package validity is empirical: record the configured feed query or resolved package graph and a successful restore. In the final result, say how the selected exact versions were proven available; do not merely name a version and leave a judge or user to infer whether it exists.
Workflow
Commit strategy: Do not create commits unless the user asks. Keep project configuration and source edits logically separable in the diff, but finish and verify the whole requested migration.
Prioritization: Steps 1-5 are required for every migration. Steps 6-12 are conditional — only apply the ones relevant to the project's code patterns. Skip steps that don't apply.
Decisions that change the result
Run this preflight before editing:
| Detected state | Required action |
|---|---|
Project references xunit.v3, has the required executable/runner configuration, contains no remaining v2 packages or v2-only API patterns, and its existing test command passes |
Stop: migration is already complete. Do not update versions, create props files, or modify source. Report the verified no-op result. If any required v3 adaptation remains, make only that repair instead of treating the package reference alone as completion. |
xUnit v2 uses YTest.MTP.XUnit2 |
Preserve MTP: remove that shim, set UseMicrosoftTestingPlatformRunner=true, and do not add xunit.runner.visualstudio or IsTestingPlatformApplication=false. |
| xUnit v2 does not use the MTP shim | Preserve VSTest: keep/update xunit.runner.visualstudio and set IsTestingPlatformApplication=false. |
A custom type derives from BeforeAfterTestAttribute |
Preserve that inheritance and its behavior. Add the IXunitTest parameter to both overrides and pass it to base.Before/base.After; do not replace the subclass with a direct interface implementation. |
| A Type-based collection/orderer attribute points to a custom type | Migrate both the attribute syntax and the referenced type's v3 contract. For a collection factory, implement the required xUnit v3 IXunitTestCollectionFactory behavior; compiling the attribute while leaving an empty factory is not |
अक्सर पूछे जाने वाले सवाल
क्या मेरे test परिणाम वही रहेंगे?
लक्ष्य अपग्रेड से पहले वाले परिणाम ही हैं, और स्किल यह जाँचने के लिए tests चलाती है।
क्या यह test platform बदलती है?
नहीं। यह मौजूदा runner रखती है, और Microsoft.Testing.Platform पर जाना एक अलग स्किल है।
क्या यह MSTest या NUnit से जाना कवर करती है?
नहीं। frameworks के बीच जाना एक अलग और बड़ा काम है।
जानकारी
लेखक का मूल विवरण
Migrate .NET test projects from xUnit.net v2 to xunit.v3 and fix v3 breaks. Use for package/CPM conversion, OutputType=Exe, preserving the VSTest or MTP runner (including projects currently using YTest.MTP.XUnit2), incompatible TFMs, async void tests, string-to-Type attributes, custom Fact/Theory/BeforeAfterTest attributes, Xunit.SkippableFact, xunit.abstractions/extensibility consolidation, and Xunit.Combinatorial/StaFact compatibility. Do not use for framework conversion or a runner-only migration. For xUnit v3 MTP filter syntax, also use migrate-vstest-to-mtp.
repo: dotnet/skills
लोकप्रियता
- GitHub स्टार
- 5.8k
- रैंकिंग में स्थान
- #14622
- लाइसेंस
- 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 पास कर सकें।