migrate-mstest-v3-to-v4
ما الذي تفعله
ترقّي هذه المهارة مشاريع اختبار .NET من MSTest v3 إلى MSTest v4، وتغطي التغييرات المخالفة في المصدر والتغييرات في طريقة تشغيل الاختبارات. وهي موجهة للفرق التي تفشل اختباراتها أو لا تُبنى بعد الترقية.
متى تستخدمها
- ✓عندما ترقّي حزم MSTest من الإصدار 3 إلى 4 ولا يعود المشروع يُبنى.
- ✓عندما تتصرف الاختبارات بشكل مختلف بعد الترقية، مثل تغييرات التنظيف أو المهلات الزمنية.
- ✓عندما تظهر مشكلة في TestMethodAttribute مخصص أو في اكتشاف الاختبارات بعد الانتقال إلى v4.
رابط المهارة
https://github.com/dotnet/skills/blob/main/plugins/dotnet-test-migration/skills/migrate-mstest-v3-to-v4/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“رقّيت حزم MSTest إلى الإصدار 4 والآن يفشل البناء بعدة أخطاء. ساعدني في إصلاحها.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
يفحص وكيلك المشروع ومصدره أولًا، ويصنّف المشكلة إلى النوع المناسب من الإصلاح، ثم يعدّل الكود ويشغّل الاختبارات حتى تنجح.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
MSTest v3 -> v4 Migration
Migrate a test project from MSTest v3 to MSTest v4. The outcome is a project using MSTest v4 that builds cleanly, passes tests, and accounts for every source-incompatible and behavioral change. MSTest v4 is not binary compatible with MSTest v3 -- any library compiled against v3 must be recompiled against v4.
First Action
Inspect the supplied project and source before searching the web or answering
from memory. Classify the request as a focused source fix, runtime behavior
change, CI discovery issue, compatibility question, or full migration, then
follow the matching row below. A clean compile does not exclude this skill:
discovery failures, TestContext lifecycle exceptions, and test-history
changes are runtime migration failures.
When to Use
- Upgrading
MSTest.TestFramework,MSTest.TestAdapter, orMSTestmetapackage from 3.x to 4.x - Upgrading
MSTest.Sdkfrom 3.x to 4.x - Fixing build errors after updating to MSTest v4 packages
- Resolving behavioral changes in test execution after upgrading to MSTest v4
- Updating custom
TestMethodAttributeorConditionBaseAttributeimplementations for v4
When Not to Use
- The project already uses MSTest v4 and builds cleanly -- migration is done
- Upgrading from MSTest v1 or v2 -- use
migrate-mstest-v1v2-to-v3first, then return here - The project does not use MSTest
- Migrating between test frameworks (e.g., MSTest to xUnit or NUnit)
Inputs
| Input | Required | Description |
|---|---|---|
| Project or solution path | No | The .csproj, .sln, or .slnx entry point containing MSTest test projects. Discover it yourself by globbing the working directory; ask only when nothing is found or the choice is genuinely ambiguous |
| Build command | No | How to build (e.g., dotnet build, a repo build script). Auto-detect if not provided |
| Test command | No | How to run tests (e.g., dotnet test). Auto-detect if not provided |
Decisions That Change the Result
| Detected request or state | Required action |
|---|---|
| Files are supplied in the current workspace | Search there and open the literal returned paths. The skill directory is not the project directory. If one tool rejects a valid path, retry with another available reader/editor; do not ask the user for a path you can discover. |
| User asks to apply changes to supplied files: "fix my project/files", "please update this source", "make the changes", or "then build and run" | Edit every affected occurrence. Run the narrowest meaningful build/test command against the actual package version; skill activation is not a reason to stop at advice. |
| User asks "what should I expect?", "how do I fix these changes?", for compatibility advice, or for a plan | Answer directly from the actual project state even when source is visible. Keep a single-symptom answer focused; include only adjacent risks that change the decision. |
| Unsupported TFM in a full migration | Update the TFM first, then update MSTest packages, then fix source breaks. Do not bury this order in a release-note inventory. |
Custom TestMethodAttribute subclass |
Treat ExecuteAsync, CallerInfo propagation, display-name handling, and the subclass's retry/result semantics as one coupled migration. Fix the actual class, not a placeholder example. |
MSTest.Sdk v4 source/API errors (ManagedType, TestTimeout, Contains) |
Give the exact source replacements, then add the adjacent runner warning: MTP mode no longer supplies Microsoft.NET.Test.Sdk; add it only if VSTest discovery is still required. |
MSTest.Sdk v4 plus vstest.console |
This is a v4 change: MTP mode no longer brings Microsoft.NET.Test.Sdk. Keep MTP and add that package for transitional VSTest discovery, opt into UseVSTest, or migrate CI to dotnet test; state which runner the choice preserves. |
Response Guidelines
- Always identify the current version first: Before recommending any migration steps, explicitly state the current MSTest version detected in the project (e.g., "Your project uses MSTest v3 (3.8.0)"). This confirms you've read the project files and grounds the migration advice.
- Resolve, do not assume, the target version: When the user asks for "latest", query the project's configured package source and select the latest stable MSTest v4 version available at execution time. Never copy the example version from this skill into the result without checking it. Keep all MS
الأسئلة الشائعة
هل ترقّي من MSTest v1 أو v2؟
لا. تلك الترقيات تمر أولًا بمهارة ترحيل MSTest v3.
هل يكفي البناء النظيف لاعتبار الترقية منتهية؟
لا. تتحقق المهارة أيضًا من سلوك التشغيل واكتشاف الاختبارات، لأن بعض التغييرات لا تظهر إلا عند تشغيل الاختبارات.
هل تغطي MSTest.Sdk؟
نعم. تغطي ترقية MSTest.Sdk من الإصدار 3 إلى 4.
التفاصيل
الوصف الأصلي من المؤلف
Use this skill before answering, planning, or editing any MSTest 3.x-to-4.x upgrade or post-upgrade failure. Triggers include "MSTest v4 breaking changes"; CS0507/CS0103/CS1061/CS1615; ExecuteAsync, CallerInfo, DisplayName, or custom TestMethodAttribute; ClassCleanupBehavior; ContainsKey; ThrowsExactly or ExpectedException; IsInstanceOfType out parameters; TestTimeout.Infinite; ManagedType; net6/net7 compatibility; TestCase.Id history; TestName in ClassInitialize; TreatDiscoveryWarningsAsErrors; discovery errors after a clean build; and MSTest.Sdk/MTP or vstest.console discovery changes. Do no
repo: dotnet/skills
الشعبية
- نجوم GitHub
- 5.8k
- الترتيب
- #14618
- الترخيص
- MIT
- آخر تحديث
- 2/11/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
create-custom-agent
5.8kيساعد وكيلك على إنشاء ملفات وكلاء مخصصين لـVS Code، لكل منهم أدواته وتعليماته وتسليماته إلى وكلاء آخرين.
create-skill
5.8kيساعد وكيلك على إنشاء مهارة وكيل جديدة باسم صالح ووصف محفّز واضح وملف SKILL.md يتبع المعيار.
csharp-scripts
5.8kيساعد وكيلك على تشغيل برنامج C# صغير كملف واحد بأداة سطر أوامر .NET، دون إنشاء مشروع كامل.
dotnet-pinvoke
5.8kيساعد وكيلك على استدعاء مكتبات C أو C++ الأصلية من .NET بشكل صحيح، مع التوقيعات ومعالجة النصوص والذاكرة والمقابض الآمنة.
مهارات مشابهة
test-driven-development
311kيعلّم وكيلك كتابة اختبار فاشل أولًا، ثم رؤيته يفشل، ثم كتابة أصغر شيفرة تنجحه، قبل بناء أي ميزة أو إصلاح.
verification-before-completion
311kيعلّم وكيلك تشغيل فحوصات حقيقية وقراءة نتائجها قبل أن يقول إن المهمة أو الإصلاح أو البناء مكتمل أو ناجح.
migrate-to-shoehorn
310kيستبدل تأكيدات النوع الخطرة في ملفات الاختبار بمكتبة shoehorn، حتى تتمكن الاختبارات من استخدام بيانات جزئية وتجتاز فحوص الأنواع.