fprime-component-unit-test
ما الذي تفعله
يرشد الوكيل إلى تخطيط اختبارات الوحدة وكتابتها لمتطلبات المكوّن ومنافذه وأحداثه وأوامره. وهي مناسبة للمهندسين الذين يتحققون من برمجيات الطيران في F Prime.
متى تستخدمها
- ✓عندما تكون معالجة مكوّن F Prime جاهزة وتحتاج إلى اختبارات وحدة.
- ✓عندما تريد كتابة اختبارات الوحدة أولا، وفق ممارسة الاختبار أولا.
- ✓عندما تريد تغطية شيفرة عالية لمكوّن F Prime.
رابط المهارة
https://github.com/nasa/fprime/blob/devel/.github/skills/fprime-component-unit-test/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“هل تستطيع كتابة اختبارات الوحدة لهذا المكوّن في F Prime تغطي كل متطلب؟”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
يجهز الوكيل بيئة الاختبار، ويكتب اختبارات لكل متطلب وواجهة، ثم يشغّلها، ويهدف إلى تغطية عالية، مع استخدام اختبارات قائمة على القواعد حيثما تناسب.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
Skill: F Prime Component Unit Testing
Unit tests verify each component requirement in isolation using the
autocoded test harness. This skill provides lifecycle context and
goals; for scaffolding, assertion macros, code patterns, and the full
implementation procedure, see fprime-unit-testing and the
unit testing guide.
Goals
- Verify all requirements with unit tests if possible.
- Verify all interfaces: ports, events, telemetry, commands.
- Prefer rule-based testing where possible — it provides broader
coverage than traditional tests. See
fprime-unit-testing§3 for criteria and constructs, and the rules-based testing guide for the full walkthrough. - Target 95% code coverage.
- You should be able to do most of this without user input, since requirements and the FPP model are already defined. However, ask the user for help with predicting edge cases you may have missed or for clarification on expected behavior.
Process
Follow fprime-unit-testing for the step-by-step procedure:
scaffold → implement → register → run. That skill covers Tester
class structure, TestMain layout, CMakeLists registration, assertion
macros, helper functions, and rules-based testing.
Key decisions within the lifecycle:
- Traditional vs. rule-based: Use the criteria table in
fprime-unit-testing§3. Default to rule-based for components with multiple ports or stateful behavior. - TDD: If following test-driven development (tests before implementation), see TDD guide. The FPP model is sufficient to write tests — implementation is not required.
- Coverage: Run
fprime-util check --coverageand review*_gcov.txt. Target 95%.
Anti-Patterns
- Testing only happy paths — off-nominal coverage is critical
- Forgetting
doDispatch()for async commands/ports - Asserting only on count (
SIZE) without checking values - Modifying component internals directly (test through the interface only)
- Guessing expected values — derive from requirements
الأسئلة الشائعة
ما هدف التغطية الذي يحدده؟
يستهدف تغطية شيفرة بنسبة 95 بالمئة.
ما الاختبار القائم على القواعد؟
هو أسلوب اختبار تفضله المهارة حيثما أمكن، لأنه يغطي مساحة أوسع من الاختبارات اليدوية الفردية.
هل يحتاج إلى مدخلاتي؟
غالبا لا، لكنه يطلب مساعدتك في السلوك المتوقع والحالات الحدّية التي قد يغفلها.
التفاصيل
الوصف الأصلي من المؤلف
Unit testing phase of F Prime component development. Provides lifecycle context, goals, and decision criteria for the unit testing phase. Defers to fprime-unit-testing for implementation details. Trigger when implementation is ready for testing or when following TDD (tests before implementation). Keywords: F Prime, unit test, GTest, TesterBase, GTestBase, Tester, fprime-util check, STest, rule-based testing.
repo: nasa/fprime
الشعبية
- نجوم GitHub
- 12k
- الترتيب
- #11499
- الترخيص
- Apache-2.0
- آخر تحديث
- 2/11/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
fprime-cmake-build-system
12kيساعد وكيلك على إضافة وحدات وأهداف بناء وإعدادات منصات إلى مشروع برمجيات طيران F Prime عبر طبقة CMake الخاصة به.
fprime-component-design-fpp
12kيساعد وكيلك على تحويل متطلبات مكوّن F Prime المعتمدة إلى نموذج FPP يصف منافذه وأوامره وأحداثه وقياساته عن بُعد.
fprime-component-development
12kيساعد وكيلك على توجيه مكوّن F Prime عبر كل مرحلة تطوير، من المتطلبات حتى اختبار التكامل.
fprime-component-implementation
12kيساعد وكيلك على كتابة شيفرة C++ خلف دوال المعالجة المولّدة لمكوّن F Prime، باتباع قواعد المشروع.
مهارات مشابهة
test-driven-development
311kيعلّم وكيلك كتابة اختبار فاشل أولًا، ثم رؤيته يفشل، ثم كتابة أصغر شيفرة تنجحه، قبل بناء أي ميزة أو إصلاح.
verification-before-completion
311kيعلّم وكيلك تشغيل فحوصات حقيقية وقراءة نتائجها قبل أن يقول إن المهمة أو الإصلاح أو البناء مكتمل أو ناجح.
migrate-to-shoehorn
310kيستبدل تأكيدات النوع الخطرة في ملفات الاختبار بمكتبة shoehorn، حتى تتمكن الاختبارات من استخدام بيانات جزئية وتجتاز فحوص الأنواع.