If you use Codeception installed using composer, install this module with the following command:
Alternatively, you can enable
Sequence module in suite configuration file and run
This module was bundled with Codeception 2 and 3, but since version 4 it is necessary to install it separately.
Some modules are bundled with PHAR files.
Warning. Using PHAR file and composer in the same project can cause unexpected errors.
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 within test and
sqs for generating unique sequences across suite.
sq generates sequence, the only parameter it takes, is id.
You can get back to previously generated sequence using that id:
Cest Suite tests:
By default produces unique string with param as a prefix:
This behavior can be configured using
prefix config param.
Old style sequences:
Using id param inside prefix: