mcpField
C
codeception-skill

codeception-skill

github.com/lambdatestテスト・品質384235 回インストール2 週間前に更新
リポジトリ

codeception-skill について

codeception-skillは、Codeceptionを使うテスト担当者向けのガイドです。受け入れ、API、データベースのテストパターンに加え、設定やCI/CDの手順を扱います。

主な機能

  1. 01Cest受け入れテストのパターン
  2. 02Actorによる画面遷移とフォーム操作
  3. 03ページオブジェクトと再利用可能な手順
  4. 04APIおよびデータベーステストのガイド
  5. 05スイート設定とCI/CD連携

活用シーン

  1. 01ログインフローの受け入れテスト作成
  2. 02RESTモジュールを使ったAPIテスト
  3. 03データベースレコードの変更確認
  4. 04WebDriverによるクラウドテスト設定

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/lambdatest/agent-skills --skill codeception-skill

インストール後、Claude Code で/codeception-skillを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

reference/
advanced-patterns.md
cloud-integration.md
playbook.md

詳細

Codeception テストスキル

基本パターン

受け入れテスト(Cest)
<?php
// tests/Acceptance/LoginCest.php

class LoginCest
{
    public function _before(AcceptanceTester $I)
    {
        $I->amOnPage('/login');
    }

    public function loginWithValidCredentials(AcceptanceTester $I)
    {
        $I->fillField('email', '[email protected]');
        $I->fillField('password', 'password123');
        $I->click('Login');
        $I->see('Dashboard');
        $I->seeInCurrentUrl('/dashboard');
        $I->seeElement('.welcome-message');
    }

    public function loginWithInvalidCredentials(AcceptanceTester $I)
    {
        $I->fillField('email', '[email protected]');
        $I->fillField('password', 'wrong');
        $I->click('Login');
        $I->see('Invalid credentials');
        $I->seeInCurrentUrl('/login');
    }
}
アクターメソッド(AcceptanceTester $I)
// Navigation
$I->amOnPage('/path');
$I->click('Button Text');
$I->click('#id');
$I->click(['xpath' => '//button']);

// Forms
$I->fillField('Name or Label', 'value');
$I->selectOption('Select', 'Option');
$I->checkOption('Checkbox');
$I->uncheckOption('Checkbox');
$I->attachFile('Upload', 'file.txt');
$I->submitForm('#form', ['email' => '[email protected]']);

// Assertions
$I->see('Text');
$I->dontSee('Text');
$I->seeElement('#id');
$I->dontSeeElement('.error');
$I->seeInField('email', '[email protected]');
$I->seeInCurrentUrl('/dashboard');
$I->seeInTitle('Page Title');
$I->seeCheckboxIsChecked('#agree');
$I->seeNumberOfElements('li', 5);

// Grabbers
$text = $I->grabTextFrom('.element');
$attr = $I->grabAttributeFrom('#link', 'href');
$value = $I->grabValueFrom('#input');
ページオブジェクト(ステップオブジェクト)
<?php
// tests/_support/Page/Login.php
namespace Page;

class Login
{
    public static $url = '/login';
    public static $emailField = '#email';
    public static $passwordField = '#password';
    public static $loginButton = 'button[type="submit"]';

    protected $I;
    public function __construct(\AcceptanceTester $I) { $this->I = $I; }

    public function login(string $email, string $password): void
    {
        $this->I->amOnPage(self::$url);
        $this->I->fillField(self::$emailField, $email);
        $this->I->fillField(self::$passwordField, $password);
        $this->I->click(self::$loginButton);
    }
}
クラウド(TestMu AI)

セットアップ全体については、reference/cloud-integration.mdを参照してください。機能のリファレンスについては、shared/testmu-cloud-reference.mdを参照してください。

クラウド設定(acceptance.suite.yml)
actor: AcceptanceTester
modules:
  enabled:
    - WebDriver:
        url: 'http://localhost:3000'
        host: 'hub.lambdatest.com'
        port: 80
        browser: chrome
        capabilities:
          'LT:Options':
            user: '%LT_USERNAME%'
            accessKey: '%LT_ACCESS_KEY%'
            build: 'Codeception Build'
            video: true

セットアップ:composer require --dev codeception/codeception codeception/module-webdriver

初期化:php vendor/bin/codecept bootstrap

実行:php vendor/bin/codecept run acceptance

詳細パターン

本番環境向けのパターンについては、reference/playbook.mdを参照してください。

セクション内容
§1 プロジェクトのセットアップインストール、codeception.yml、スイートの設定
§2 受け入れテストCest パターン、@dataProvider、WebDriver の操作
§3 API テストREST モジュール、CRUD 操作、@depends、HttpCode
§4 ページオブジェクト静的セレクターを持つページクラス、再利用可能なメソッド
§5 データベーステストhaveInDatabase、seeInDatabase、updateInDatabase
§6 カスタムヘルパーCodeception Module を拡張するカスタムモジュール
§7 CI/CD 統合MySQL、Selenium、カバレッジを使用した GitHub Actions
§8 デバッグ表よくある問題 12 件と原因、解決方法
§9 ベストプラクティスCodeception テストの 14 項目チェックリスト

コメント