tdd — for Claude Code arkui_ace_engine, community, for Claude Code, ide skills, OnModifyDone(), OnDirtyLayoutWrapperSwap(), menuPattern->OnModifyDone(), menuPattern->FireBuilder(), Writing, Guidelines

v1.0.0

Über diesen Skill

Perfekt für Testgetriebene Entwicklung Agenten, die strukturierte Richtlinien für NG-Komponentenmuster-Methoden benötigen Lokalisierte Zusammenfassung: This skill should be used when writing unit tests, TDD test cases, test coverage analysis, or test-driven development for NG component Pattern methods (e.g., OnModifyDone, OnDirtyLayoutWrapperSwap). This AI agent skill supports Claude Code, Cursor, and Windsurf

Funktionen

TDD Writing Guidelines for NG Component Pattern Methods
Direct Method Invocation
Call the target method directly, not through indirect triggers.
✅ menuPattern- OnModifyDone()
❌ menuPattern- FireBuilder() (doesn't trigger OnModifyDone())

# Core Topics

eclipse-oniro-mirrors eclipse-oniro-mirrors
[0]
[0]
Updated: 3/13/2026

Killer-Skills Review

Decision support comes first. Repository text comes second.

Reference-Only Page Review Score: 8/11

This page remains useful for teams, but Killer-Skills treats it as reference material instead of a primary organic landing page.

Original recommendation layer Concrete use-case guidance Explicit limitations and caution
Review Score
8/11
Quality Score
47
Canonical Locale
en
Detected Body Locale
en

Perfekt für Testgetriebene Entwicklung Agenten, die strukturierte Richtlinien für NG-Komponentenmuster-Methoden benötigen Lokalisierte Zusammenfassung: This skill should be used when writing unit tests, TDD test cases, test coverage analysis, or test-driven development for NG component Pattern methods (e.g., OnModifyDone, OnDirtyLayoutWrapperSwap). This AI agent skill supports Claude Code, Cursor, and Windsurf

Warum diese Fähigkeit verwenden

Ermöglicht es den Agenten, effektive TDD-Tests für NG-Komponentenmuster-Methoden zu schreiben, indem sie die direkte Methodenaufruf und die Prinzipien der Zustandsrücksetzung verwenden und dabei gängige Fallstricke in der Testzuverlässigkeit vermeiden, während sie mit NG-Komponenten und -Methoden

Am besten geeignet für

Perfekt für Testgetriebene Entwicklung Agenten, die strukturierte Richtlinien für NG-Komponentenmuster-Methoden benötigen

Handlungsfähige Anwendungsfälle for tdd

Schreiben von zuverlässigen TDD-Tests für NG-Komponentenmuster-Methoden
Vermeiden von indirekten Auslösern in Testaufrufen
Zurücksetzen des Zustands, um Störungen in der Testzuverlässigkeit zu vermeiden

! Sicherheit & Einschränkungen

  • Erfordert Verständnis für NG-Komponentenmuster-Methoden
  • Begrenzt auf TDD-Tests für NG-Komponenten
  • Kann eine zusätzliche Einrichtung für die Testumgebung erfordern

Why this page is reference-only

  • - Current locale does not satisfy the locale-governance contract.
  • - The underlying skill quality score is below the review floor.

Source Boundary

The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.

After The Review

Decide The Next Action Before You Keep Reading Repository Material

Killer-Skills should not stop at opening repository instructions. It should help you decide whether to install this skill, when to cross-check against trusted collections, and when to move into workflow rollout.

Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is tdd?

Perfekt für Testgetriebene Entwicklung Agenten, die strukturierte Richtlinien für NG-Komponentenmuster-Methoden benötigen Lokalisierte Zusammenfassung: This skill should be used when writing unit tests, TDD test cases, test coverage analysis, or test-driven development for NG component Pattern methods (e.g., OnModifyDone, OnDirtyLayoutWrapperSwap). This AI agent skill supports Claude Code, Cursor, and Windsurf

How do I install tdd?

Run the command: npx killer-skills add eclipse-oniro-mirrors/arkui_ace_engine/tdd. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for tdd?

Key use cases include: Schreiben von zuverlässigen TDD-Tests für NG-Komponentenmuster-Methoden, Vermeiden von indirekten Auslösern in Testaufrufen, Zurücksetzen des Zustands, um Störungen in der Testzuverlässigkeit zu vermeiden.

Which IDEs are compatible with tdd?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for tdd?

Erfordert Verständnis für NG-Komponentenmuster-Methoden. Begrenzt auf TDD-Tests für NG-Komponenten. Kann eine zusätzliche Einrichtung für die Testumgebung erfordern.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add eclipse-oniro-mirrors/arkui_ace_engine/tdd. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use tdd immediately in the current project.

! Reference-Only Mode

This page remains useful for installation and reference, but Killer-Skills no longer treats it as a primary indexable landing page. Read the review above before relying on the upstream repository instructions.

Upstream Repository Material

The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.

Upstream Source

tdd

Install tdd, an AI agent skill for AI agent workflows and automation. Review the use cases, limitations, and setup path before rollout.

SKILL.md
Readonly
Upstream Repository Material
The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.
Supporting Evidence

TDD Writing Guidelines for NG Component Pattern Methods

When writing TDD tests for NG component Pattern methods (e.g., OnModifyDone(), OnDirtyLayoutWrapperSwap()), follow these guidelines to avoid common pitfalls.

Core Principles

1. Direct Method Invocation

Call the target method directly, not through indirect triggers.

  • menuPattern->OnModifyDone()
  • menuPattern->FireBuilder() (doesn't trigger OnModifyDone())

2. State Reset

Always reset potentially interfering state before calling target method.

cpp
1// Reset to clean state before testing 2auto renderContext = menuNode->GetRenderContext(); 3renderContext->ResetOuterBorder(); // Reset entire property group 4 5// Then call target method 6menuPattern->OnModifyDone();

3. API Verification

Use Grep/Read tools to verify method names, never guess.

bash
1# Search for method definition 2grep -rn "ResetOuterBorder\|Reset.*Outer" frameworks/core/components_ng/render/render_context.h 3 4# Understand macro-generated methods 5grep -A 5 "ACE_DEFINE_PROPERTY_GROUP" frameworks/core/components_ng/property/property.h
  • ACE_DEFINE_PROPERTY_GROUP(OuterBorder, OuterBorderProperty) generates:
    • GetOrCreateOuterBorder(), GetOuterBorder(), CloneOuterBorder(), ResetOuterBorder()
    • NOT ResetOuterBorderRadius() (common mistake)

4. Branch Coverage

Write paired tests for if/else branches.

cpp
1// Branch 1: Condition is true 2HWTEST_F(Xxx, Test_BranchTrue, TestSize.Level1) { 3 borderRadiusVP.SetRadius(Dimension(10.0_vp)); // No PERCENT unit 4 renderContext->ResetOuterBorder(); 5 pattern->OnModifyDone(); 6 EXPECT_TRUE(outerRadius.has_value()); 7} 8 9// Branch 2: Condition is false 10HWTEST_F(Xxx, Test_BranchFalse, TestSize.Level1) { 11 borderRadiusPercent.SetRadius(Dimension(50.0f, DimensionUnit::PERCENT)); 12 renderContext->ResetOuterBorder(); 13 pattern->OnModifyDone(); 14 EXPECT_FALSE(outerRadius.has_value()); 15}

5. No Line Numbers in Comments

Avoid hardcoding line numbers in test comments.

  • OnModifyDone should skip UpdateBorderRadius at line 299
  • OnModifyDone should skip UpdateBorderRadius when borderRadius has percent unit
  • Reason: Line numbers change as code evolves, making comments outdated
  • Alternative: Describe the logical condition being tested rather than the physical line location

6. No Documentation-Only Tests

Every test case must have actual test logic.

  • ❌ Documentation-only test with only comments and EXPECT_TRUE(true)
  • ✅ Test with real assertions and verification logic
  • Reason: Tests without executable logic don't verify behavior and waste maintenance resources
  • Alternative: Put branch documentation in separate design documents or code comments, not in test cases
  • Example of what NOT to do:
    cpp
    1// ❌ BAD: Documentation-only test 2HWTEST_F(ComponentPatternTestNg, ComponentPattern_BranchDocumentation, TestSize.Level1) { 3 /** 4 * @tc.steps: step1. Document branches 5 * Branch 1: condition is true 6 * Branch 2: condition is false 7 */ 8 EXPECT_TRUE(true); // No actual testing! 9}
  • Correct approach: Write separate test cases for each branch with real logic

7. No Magic Numbers

Use named constants instead of hardcoded numbers.

  • ❌ Hardcoded numbers like 720, 1280, 0, 3.0, -1, 100000
  • ✅ Named constants with clear semantic meaning
  • Reason: Magic numbers make code hard to understand and maintain. Constants provide context and make changes easier
  • Where to define: Place constants in anonymous namespace at the top of the test file
  • Example:
    cpp
    1// ❌ BAD: Magic numbers 2HWTEST_F(ComponentPatternTestNg, ComponentPattern_TestBranch, TestSize.Level1) { 3 SystemProperties::InitDeviceInfo(720, 1280, 0, 3.0, false); 4 auto size = GetSubWindowSize(100000, 0); 5 EXPECT_GT(size.Width(), 0); 6} 7 8// ✅ GOOD: Named constants 9namespace { 10 const int32_t TEST_DEVICE_WIDTH = 720; 11 const int32_t TEST_DEVICE_HEIGHT = 1280; 12 const int32_t TEST_DEVICE_ORIENTATION = 0; 13 const double TEST_DEVICE_RESOLUTION = 3.0; 14 const bool TEST_DEVICE_IS_ROUND = false; 15 const int32_t TEST_PARENT_CONTAINER_ID = 100000; 16 const uint32_t DEFAULT_DISPLAY_ID = 0; 17} 18HWTEST_F(ComponentPatternTestNg, ComponentPattern_TestBranch, TestSize.Level1) { 19 SystemProperties::InitDeviceInfo( 20 TEST_DEVICE_WIDTH, TEST_DEVICE_HEIGHT, TEST_DEVICE_ORIENTATION, 21 TEST_DEVICE_RESOLUTION, TEST_DEVICE_IS_ROUND); 22 auto size = GetSubWindowSize(TEST_PARENT_CONTAINER_ID, DEFAULT_DISPLAY_ID); 23 EXPECT_GT(size.Width(), 0); 24}

Test Template

cpp
1/** 2 * @tc.name: PatternMethod_TestBranchName 3 * @tc.desc: Test Description covering specific behavior (e.g., "when X happens, Y should occur") 4 * @tc.type: FUNC 5 */ 6HWTEST_F(ComponentPatternTestNg, ComponentPattern_TestBranchName, TestSize.Level1) 7{ 8 // 1. Environment setup 9 MockPipelineContext::GetCurrent()->SetMinPlatformVersion(static_cast<int32_t>(PlatformVersion::VERSION_ELEVEN)); 10 ScreenSystemManager::GetInstance().dipScale_ = DIP_SCALE; 11 12 // 2. Create nodes (using existing helper methods like GetPreviewMenuWrapper) 13 auto menuWrapperNode = GetPreviewMenuWrapper(); 14 ASSERT_NE(menuWrapperNode, nullptr); 15 auto menuNode = AceType::DynamicCast<FrameNode>(menuWrapperNode->GetChildAtIndex(0)); 16 ASSERT_NE(menuNode, nullptr); 17 auto menuPattern = menuNode->GetPattern<MenuPattern>(); 18 ASSERT_NE(menuPattern, nullptr); 19 auto menuLayoutProperty = menuNode->GetLayoutProperty<MenuLayoutProperty>(); 20 ASSERT_NE(menuLayoutProperty, nullptr); 21 auto renderContext = menuNode->GetRenderContext(); 22 ASSERT_NE(renderContext, nullptr); 23 24 // 3. Set test data to trigger target branch 25 TestDataType testData; 26 testData.SetValue(...); // Configure to trigger branch 27 menuLayoutProperty->UpdateProperty(testData); 28 29 // 4. Reset interfering state (CRITICAL!) 30 renderContext->ResetTargetProperty(); 31 32 // 5. Call target method directly 33 menuPattern->TargetMethod(); 34 35 // 6. Verify results match branch expectation 36 auto result = renderContext->GetTargetProperty(); 37 EXPECT_TRUE(result.has_value()); // Or false based on branch 38}

Common Pitfalls

PitfallSymptomSolution
Indirect method callTest doesn't trigger target code pathCall target method directly
No state resetTest fails with unexpected valuesReset all potentially interfering properties before calling method
Guessed API nameCompilation error or method not foundUse Grep to verify exact method name from source
Unclean test dataTests interfere with each otherEach test should be independent, reset all state
Missing branch coverageCode coverage shows gapsWrite tests for both true and false branches
Line numbers in commentsComments become outdated when code changesDescribe logical conditions instead of physical locations
Documentation-only testsTest contains only comments with EXPECT_TRUE(true)Every test must have real assertions and verification logic
Magic numbersHardcoded numbers like 720, 1280, 100000 without meaningUse named constants with clear semantic meaning in anonymous namespace

Mandatory Self-Checklist

After generating test code, verify:

  • All called methods exist (verified via Grep/Read)
  • State is reset before calling target method
  • Test data triggers the correct branch (HasPercentUnit returns expected value)
  • Assertions match branch behavior
  • All API signatures match source definitions
  • Test follows existing test file structure and naming conventions
  • Comments describe logical behavior, not line numbers (e.g., use "when X happens" instead of "at line 299")
  • Every test case has real test logic (not just documentation with EXPECT_TRUE(true))
  • No magic numbers - all numeric literals replaced with named constants

Reference Implementation

See working example at: test/unittest/core/pattern/menu/menu_pattern_test_ng.cpp:1482-1574

  • MenuPatternTest_OnModifyDone_UpdateBorderRadius - Tests when border has no PERCENT unit
  • MenuPatternTest_OnModifyDone_PercentBorderRadius - Tests when border has PERCENT unit

Verwandte Fähigkeiten

Looking for an alternative to tdd or another community skill for your workflow? Explore these related open-source skills.

Alle anzeigen

openclaw-release-maintainer

Logo of openclaw
openclaw

Lokalisierte Zusammenfassung: 🦞 # OpenClaw Release Maintainer Use this skill for release and publish-time workflow. It covers ai, assistant, crustacean workflows. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

333.8k
0
Künstliche Intelligenz

widget-generator

Logo of f
f

Lokalisierte Zusammenfassung: Generate customizable widget plugins for the prompts.chat feed system # Widget Generator Skill This skill guides creation of widget plugins for prompts.chat . It covers ai, artificial-intelligence, awesome-list workflows. This AI agent skill supports Claude Code

149.6k
0
Künstliche Intelligenz

flags

Logo of vercel
vercel

Lokalisierte Zusammenfassung: The React Framework # Feature Flags Use this skill when adding or changing framework feature flags in Next.js internals. It covers blog, browser, compiler workflows. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

138.4k
0
Browser

pr-review

Logo of pytorch
pytorch

Lokalisierte Zusammenfassung: Usage Modes No Argument If the user invokes /pr-review with no arguments, do not perform a review . It covers autograd, deep-learning, gpu workflows. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

98.6k
0
Entwickler