i am using Codeception for testing. I am using data providers and everything is working well. But i need to be able just say "i need to start only line 1 from data provider", how can i do it?
protected function pageProviderTest(){
return[
['version' => 1],
['version' => 2],
['version' => 3],
];
}
/**
* @param WebdriverTester $I
* @dataProvider pageProviderTest
*/
public function test1(WebdriverTester $I, Example $example){
$I->see($example['version']);
}
So for example, now i only want to test if test see "1". Other test i dont want even start.
So i find answer. You have to make new Example object and give him parameter which you want to use, so in this situation it will be look´s something like:
private $testingData;
public function __construct()
{
$this->testingData = new Example(pageProviderTest[0]); // enter the num of line in field
}
protected function pageProviderTest(){
return[
['version' => 1],
['version' => 2],
['version' => 3],
];
}
/**
* @param WebdriverTester $I
*
*/
protected function test1(WebdriverTester $I, Example $example){
$I->see($example['version']);
}
public function startTest(WebdriverTester $I){
test1($I, $this->testingData);
}