@dataProvider in Cest format in Codeception
How to use "@dataProvider" in Cest format? ( http://codeception.com/docs/05-UnitTests#Cest ) For example, I have this code. How to write it in Cest format
class ExampleTest extends \Codeception\TestCase\Test
{
/**
* @dataProvider providerAdd
*/
public function testAdd($a, $b, $c)
{
$this->assertEquals($c, ($a + $b));
}
public function providerAdd()
{
return array (
array (2, 2, 4),
array (2, 3, 5),
array (3, 5, 8)
);
}
}
source to share
Since Codeception 2.2 has a better alternative, use "examples": http://codeception.com/docs/07-AdvancedUsage#examples
This is a Cest-style implementation that you know as dataProviders in unit / functional tests. Currently it only allows you to feed datasets into annotations, but it is workable ...
source to share
@dataProvider
is a PHPUnit annotation that is not evaluated in Cest or Cept execution.
If you want to write tests in TDD / BDD style, you can follow the Codeception guidelines . In addition, Specify supports examples , which can replace the use of php annotations.
source to share