tdd

Generate structured TDD unit tests for NG component Pattern methods.

Updated Sep 22, 2023
One-click install
npx skills add https://github.com/eclipse-oniro-mirrors/arkui_ace_engine --skill tdd-eclipse-oniro-mirrors
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd
Source: https://github.com/eclipse-oniro-mirrors/arkui_ace_engine/tree/main/.claude/skills/tdd
Command: npx skills add https://github.com/eclipse-oniro-mirrors/arkui_ace_engine --skill tdd-eclipse-oniro-mirrors

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill enables engineers to author robust TDD tests for NG component Pattern methods by following explicit guidelines.

Core Features & Use Cases

  • Direct method invocation: tests call the target method directly to ensure the exact code path is exercised.
  • State reset and isolation: tests reset interfering state before each run to ensure predictability.
  • Branch coverage and API verification: tests cover if/else branches and verify API names with tooling.
  • Self-checklist and no-magic-numbers: tests include a mandatory checklist and avoid hard-coded magic numbers.

Quick Start

Run the TDD guidance to generate structured unit tests for a given NG component pattern method (e.g., OnModifyDone).

Frequently Asked Questions about tdd

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write TDD tests for NG component pattern methods like OnModifyDone?

To write TDD tests for NG component pattern methods, you should invoke target methods directly, reset interfering state before each run for isolation, and cover all if/else branches to ensure exact code paths are exercised predictably.

What is the best way to isolate NG component tests to avoid state interference?

The best way to isolate NG component tests is to reset interfering state before each test run, ensuring predictability by preventing previous test executions from affecting the current method invocation and its verified outcomes.

How do I verify API names and ensure branch coverage when testing NG components?

To verify API names and ensure branch coverage when testing NG components, utilize your project's existing tooling to check API names and explicitly test all if/else branches within pattern methods like OnDirtyLayoutWrapperSwap.

Do I need extra testing tools to apply TDD guidelines for NG component methods?

No, you do not need extra testing tools to apply these TDD guidelines; the approach requires nothing beyond your project's existing unit-testing framework and conventions to validate method naming and test isolation.

Why should I avoid magic numbers in NG component unit tests?

You should avoid magic numbers in NG component unit tests to maintain clarity and robustness; the guidelines mandate a self-checklist and the avoidance of hard-coded magic numbers to ensure deterministic and maintainable test structures.

Related Skills