Tzook Bar Noy Tzook Bar Noy - 10 months ago 71
PHP Question

Codeception: How can I run only one test from a suite?

I have this test class below, and I want to run only one test from it, for example the "aboutPage". Any ideas how?

This is how I run only this file:

codecept run tests/acceptance/VisitorCest.php

But now I want to run only one test from the file.

use \AcceptanceTester;

class VisitorCest
public function _before(){}
public function _after(){}

public function aboutPage(AcceptanceTester $I)
$I->wantTo('check about page');

public function contactPage(AcceptanceTester $I)
$I->wantTo('check contact page');


You simply append a colon and the function name, like this:

codecept run tests/acceptance/VisitorCest.php:myTestName

or a shorter version:

codecept run acceptance VisitorCest:myTestName

(Notice the space between the suite-name and the file-name.)