スキル一覧に戻る
mgkyawzayya

testing

by mgkyawzayya

1🍴 0📅 2025年12月16日
GitHubで見るManusで実行

SKILL.md


name: testing description: | Write and manage tests using TDD with Pest (PHP), Vitest (React), and Playwright (E2E). Use when writing feature tests, unit tests, component tests, or improving test coverage. EXCLUSIVE to testing-expert agent. allowed-tools: Read, Edit, Bash, Grep, Glob, Write

Testing

Exclusive to: testing-expert agent

Validation Loop (MANDATORY)

After writing or modifying tests, always verify:

composer test           # PHP tests pass
npm run test           # JS tests pass (if applicable)

TDD Feedback Loop:

  1. Write test → Verify it FAILS (Red)
  2. Implement minimal code → Verify it PASSES (Green)
  3. Refactor → Verify it still PASSES
  4. Repeat for edge cases

Instructions (TDD Workflow)

StepActionVerification
1Write failing testcomposer test --filter=NewTest → FAILS
2Implement minimal codecomposer test --filter=NewTest → PASSES
3Refactorcomposer test → ALL PASS
4Add edge casesRepeat steps 1-3

Pest Patterns (Laravel)

Feature Test

test('user can create post', function () {
    $user = User::factory()->create();
    
    $this->actingAs($user)
        ->post('/posts', ['title' => 'Test'])
        ->assertRedirect('/posts');
        
    $this->assertDatabaseHas('posts', ['title' => 'Test']);
});

Unit Test

test('generates slug from title', function () {
    expect((new SlugGenerator)->generate('Hello World'))
        ->toBe('hello-world');
});

Vitest Patterns (React)

describe('PostForm', () => {
    it('submits with valid data', async () => {
        const onSubmit = vi.fn();
        render(<PostForm onSubmit={onSubmit} />);
        
        await userEvent.type(screen.getByLabelText(/title/i), 'Test');
        await userEvent.click(screen.getByRole('button', { name: /submit/i }));
        
        expect(onSubmit).toHaveBeenCalled();
    });
});

Test Commands

# Laravel
composer test
php artisan test --filter=PostTest
php artisan test --coverage

# React
npm run test
npm run test:watch
npm run test:coverage

Examples

  • "Write tests for PostController"
  • "Add unit tests for this service"
  • "Fix failing test"

スコア

総合スコア

50/100

リポジトリの品質指標に基づく評価

SKILL.md

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

+20
LICENSE

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

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

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

0/5
Issue管理

オープンIssueが50未満

+5
言語

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

+5
タグ

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

0/5

レビュー

💬

レビュー機能は近日公開予定です