Skip to content
Advertisement

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.

<?php
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');
    }
}

Advertisement

Answer

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.)

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement