add-missing-unit-test

tarafından flutter

Şu anda testi olmayan bir sınıf için yeni bir birim testi ekleyin veya mevcut bir test dosyasına yeni bir test senaryosu ekleyerek Kover ile iyileştirmeyi doğrulayın.

npx skills add https://github.com/flutter/flutter-intellij --skill add-missing-unit-test

Skill: Add Missing Unit Test

You are tasked with adding a new unit test for a class that currently lacks one, or adding a new test case to an existing test file, to improve code coverage and reliability.

Objective

Add a new unit test for a class that currently lacks one, or add a new test case to an existing test file, to improve code coverage and reliability.

Workflow Instructions

1. Identify Target

  • Choose a class in src/ that has complex logic but logic coverage is missing or incomplete.

2. Establish Baseline

  • Run ./gradlew testClasses to compile all sources (production and test) and ensure the project is in a valid state.
  • Run ./gradlew verifyPlugin to ensure no plugin verification issues exist.
  • Run ./gradlew test (or specific test if it exists) to establish current pass/fail status.
  • Run tests with Kover (./gradlew koverHtmlReport or ./gradlew koverXmlReport) to determine current coverage percentage for target class.

3. Implement Test

  • Create a new test class ([ClassName]Test) in testSrc/ if it doesn't exist.
  • Add test cases to cover specific methods, edge cases, and branches.
  • Ensure the test follows project testing conventions (naming, mocking, assertions).

4. Verify

  • Run ./gradlew testClasses to ensure new test compiles.
  • Run new test (and related tests) to ensure it passes.
  • Run ./gradlew verifyPlugin to ensure no regressions in plugin verification.
  • Run Kover again to confirm coverage improvement.

5. Report & Review

  • Summarize test added and coverage improvement.
  • Test Location: Explicitly state where in the IDE user should go to test changed functionality (e.g., "Run the new test file [TestFileName]").
  • Action: Ask user to review new test closely. Validate that code being tested is actively used (e.g., check that it is not dead code/0 references).
  • Do not commit or push.
  • Provide a suggested Git commit message, explicitly including the Kover coverage improvement:
    • Example Pattern: Add unit tests for [Class Name]. Coverage verified using Kover. Coverage improvement: [Class Name]: ~[X]% line coverage ([Y] covered, [Z] uncovered).

flutter tarafından daha fazla skill

dart-modern-features
flutter
Modernizasyon için adayları bulmak amacıyla:
flutter-fix-layout-issues
flutter
Flutter düzen hatalarını (taşmalar, sınırsız kısıtlamalar) Dart ve Flutter MCP araçlarını kullanarak düzeltir. "RenderFlex overflowed", "Vertical…" sorunlarını giderirken kullanın.
adding-release-notes
flutter
Kullanıcıya yönelik değişiklik açıklamalarını DevTools sürüm notlarına ekler. NEXT_RELEASE_NOTES.md dosyasında iyileştirmeleri, düzeltmeleri veya yeni özellikleri belgelemek için kullanın.
reviewing-devtools-prs
flutter
DevTools deposuna özgü, DevTools stil kurallarını ve yaygın inceleme desenlerini uygulayan PR inceleme iş akışı. … içindeki pull request'leri incelerken kullanın.
dart-use-primary-constructors
flutter
Kullanıcıların Dart'ta sözdizimsel ve anlamsal olarak doğru birincil constructor'lar yazmasına yardımcı olun ve yeni constructor sözdizimine, boş gövdeli noktalı virgül sözdizimine geçiş yapın/kullanın,…
code-documentation
flutter
Etkili kod dokümantasyonu yazma rehberi; docstring'ler, JSDoc, dartdoc ve uygulama yorumları dahil. Yeni kod yazarken, eklerken…
api-review
flutter
Belirtilen kodu, kanonik API Tasarım yönergelerine göre inceler. Kullanıcı bir API incelemesi istediğinde veya kodun API tasarımına uygunluğunu kontrol etmek istediğinde bu beceriyi kullanın…
flutter-accessibility
flutter
Flutter uygulamalarında WCAG 2 ve EN 301 549 erişilebilirlik standartları ile uyarlanabilir düzenleri uygular. Mobil, web ve masaüstü platformlarında anlamsal açıklamaları, dokunma hedef boyutlarını (minimum 48x48 dp) ve metin kontrast oranlarını (küçük metin için 4.5:1, büyük metin için 3:1) zorunlu kılar. Web anlambilimi başlatma, etkileşimli widget sarma, ekran boyutuna dayalı düzen değiştirme ve klavye/fare giriş işleme için karar mantığı sağlar. FocusTraversalGroup ve... aracılığıyla odak geçiş yönetimini içerir.