Back to list
AVRA-CADAVRA

test-implementation-requirements

by AVRA-CADAVRA

0🍴 0📅 Jan 24, 2026

SKILL.md


name: test-implementation-requirements description: Enforces test implementation requirements: real dependencies, no mocks/stubs unless approved. Use when writing tests, reviewing test implementations, or ensuring tests use real functionality.

Test Implementation Requirements

Core Principle

Tests must test real functionality. Mocks and stubs have strict limitations.

Mandatory Requirements

✅ REQUIRED

  • Real Functionality - Tests exercise actual code paths and real dependencies
  • Real Dependencies - Use actual services, repositories, and data sources
  • Integration Testing - Prefer integration tests that test multiple components together
  • Real Data - Use real data structures, real serialization, real validation

Mocks - Rare Cases Only

⚠️ Mocks require explicit approval and justification:

Before using any mock, you MUST:

  1. Explain why a mock is necessary (what makes this a rare case)
  2. Explain what real functionality would be tested if not for the mock
  3. Get explicit user approval before implementing

Potentially acceptable rare cases:

  • External APIs that charge per request
  • Hardware dependencies that don't exist in test environment
  • Time-dependent operations requiring specific timing control
  • Network failures difficult to simulate with real dependencies

Even in rare cases: Prefer real implementations with test doubles (fake implementations) over mocks.

Stubs - Never Acceptable

❌ STUBS - FORBIDDEN:

  • Stubs are FORBIDDEN in all cases
  • Never use stubs as a replacement for real functionality
  • Use real test implementations or get approval for mocks

Test Pattern Examples

✅ GOOD: Real Dependencies

test('repository fetches data from database', () async {
  // Use real database (in-memory for tests)
  final database = await SembastDatabase.useInMemoryForTests();
  final repository = MyRepositoryImpl(
    dataSource: MyLocalDataSource(database),
  );
  
  // Test with real implementation
  final result = await repository.getData();
  expect(result, isNotNull);
});

❌ BAD: Mock Dependencies

test('repository fetches data', () {
  // ❌ Mock without justification
  final mockDataSource = MockDataSource();
  final repository = MyRepositoryImpl(dataSource: mockDataSource);
  
  when(() => mockDataSource.getData()).thenReturn('test');
  // Tests mock, not real functionality
});

Checklist

  • Tests use real functionality and real dependencies
  • No stubs used anywhere
  • If mocks are used, approval was obtained with explanation
  • Mock usage is documented with justification
  • Real behavior is tested, not just mocked behavior

Reference

  • .cursorrules - Test Implementation Requirements section

Score

Total Score

60/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon