This should really be something simple and straight forward but I haven't been able to find an answer anywhere online. When using a scenario outline in Behat, how can I access the example values inside my test? For the below example, how would i access the email address in my test? My automated test will basically fill in a text field with an email address so I want to know how can i fill it with the email_value being used for this particular scenario that is being run?
Feature: Email validation Background: Given I am on “www.somewebsite.com” Scenario Outline: Confirm email validation Given I fill in the email field with “” When I submit the form Then I should see “” **Examples:** | | | | | A validation message that email is required| | steve@ | A validation message that email must be valid | | valid@email.com | The review page |
This is a function my test case is calling, it's just finding the textfield and filling in an email address... Instead of filling it with "testing", I want to actually fill it out with the email_value from my outline. How can I access that value from within my function below?
public function fillForm() { $element = $this->driver->findElement($this->emailTextField); $element->click(); $element->sendKeys("testing"); #Please review your response and confirm. }
2) 2nd question somewhat related is that I want to check the submission_result to see if it doesn't contain the word "validation message" then I know it was a successfully (e.g. valid) email and will take me to a success page rather than display an error.
Thanks guys!