-
Notifications
You must be signed in to change notification settings - Fork 59
Harnessing Cucumber's Power
rquellh edited this page May 15, 2018
·
5 revisions
So you've created you're first Cucumber scenario, but you might be wondering why we went through all of that trouble. The plain TestCafe test worked just as good as the Cucumber + TestCafe test. The following document will show you the power of creating Cucumber scenarios.
Since I've created my tests to be flexible, I can now create a similar test with different data by just creating a new scenario in my .feature
file. Since I'm going to reuse my steps I don't have to make any code changes to the step definitions. Let's try it.
- Add the following scenario to the
sample_form.feature
file
Scenario: Form Submission - Required Fields Only - Jane Doe
Given I navigate to the example form page
When I fill out the name field with "Jane Doe"
And I fill out the email field with "janedoe@gmail.com"
And I fill out the comment box with "This is a comment Jane Doe"
And I select "5-7" from the expereince dropdown
And I click the submit button
Then I see "Jane Doe" in the name field on the submission form
And I see "janedoe@gmail.com" in the email field on the submission form
And I see "5-7" in the expereince field on the submission form
And I see "This is a comment Jane Doe" in the message field on the submission form
And I see the "Message Sent" message
- Run the tests. You should our first scenario run, and then you should see the second scenario run with different information from the first scenario.