I just started using TDD approach and came across codeception.
I searched the web a lot but didn't find a proper explanation or differentiation between cest
and cept
files in codeception.
Their format is the only difference.
Cept is a scenario-based format and Cest is a class based format.
<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('log in as regular user');
$I->amOnPage('/login');
$I->fillField('Username','john');
$I->fillField('Password','secret');
$I->click('Login');
$I->see('Hello john');
<?php
class UserCest
{
public function loginAsRegularUser(\AcceptanceTester $I)
{
$I->wantTo('log in as regular user');
$I->amOnPage('/login');
$I->fillField('Username','john');
$I->fillField('Password','secret');
$I->click('Login');
$I->see('Hello john');
}
}
Non-developers may find the Cept format more friendly and approachable. PHP developers may prefer the Cest format which is able to support multiple tests per file and easy reuse of code by adding additional private functions.
In the end it is just a matter of taste and you can choose the format you prefer.