Skip to content

Latest commit

 

History

History
65 lines (40 loc) · 2.15 KB

File metadata and controls

65 lines (40 loc) · 2.15 KB
layout doc
title Sequence - Codeception - Documentation

Sequence solves data cleanup issue in alternative way. Instead cleaning up the database between tests, you can use generated unique names, that should not conflict. When you create article on a site, for instance, you can assign it a unique name and then check it.

This module has no actions, but introduces a function sq for generating unique sequences.

Usage

Function sq generates sequence, the only parameter it takes, is id. You can get back to previously generated sequence using that id:

{% highlight php %}

{% endhighlight %}

Example:

{% highlight php %}

wantTo('create article'); $I->click('New Article'); $I->fillField('Title', 'Article'.sq('name')); $I->fillField('Body', 'Demo article with Lorem Ipsum'); $I->click('save'); $I->see('Article'.sq('name') ,'#articles') ?>

{% endhighlight %}

Populating Database:

{% highlight php %}

haveInDatabase('users', array('login' => 'user'.sq($i), 'email' => 'user'.sq($i).'@email.com'); } ?>

{% endhighlight %}

 

Module reference is taken from the source code. Help us to improve documentation. Edit module reference