How shall I 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)
);
}
}
Since Codeception 2.2 there is a better alternative, using 'examples': http://codeception.com/docs/07-AdvancedUsage#examples
This is a Cest-style implementation of what you know as dataProviders in unit/functional tests. It currently only allows to supply data sets in annotations, but it's workable...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With