0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

一部テストをスキップする方法【Laravel】

Posted at

結論

@group skip

--exclude-group=skip

を組み合わせると、
「このテストだけ一時的に実行しないようにスキップする」 という使い方ができます

✅ やり方

① スキップしたいテストクラス or テストメソッドに @group skip を付ける

/PasswordResetTest.php
/** @group skip */
class PasswordResetTest extends TestCase
{
    // ...
}

↑ これを付けると、このテストは「skipグループ」に分類されます。

② artisanコマンド側で「skip」グループを除外して実行

php artisan test --exclude-group=skip

@group skip が付いたテストだけ除外して、残り全部実行してくれます!

よくある使い方
・ 認証系テスト(メール通知必要)など、いまは通らなくてもいいテストを除外

・ Laravel Breeze入れた直後に大量にAuthテストがあるとき → 一旦スキップしておきたいとき

・ 開発中にあるテストだけ繰り返し実行したいとき

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?