Thursday, April 12, 2012

Generate custom steps with behat

I try to write a custom step that's generate step



my code looks like :



/**
* @Then /^Check_raoul$/
*/
public function checkRaoul()
{
// grab the content ...

// get players ...
$to_return = array();
foreach ($players as $player) {
$player = $player->textContent;
if (preg_match('/^.*video=([^&]*)&.*$/', $player, $matches))
{
array_push($to_return, new Step\Then('I check the video of id "'.$matches[1].'"'));
}
}
return $to_return;
}

/**
* @Then /^I check the video of id "([^"]*)"$/
*/
public function iCheckTheVideoOfId($id)
{
// ...
}


works fine but when integrating to jenkins or un cli, if many executions of iCheckTheVideoOfId fail, I see just one error. I wish generate a number of steps equal to the number of iCheckTheVideoOfId calls



what I a doing wrong ?





No comments:

Post a Comment