The length of the cucumber?

I am creating a cucumber test for a multi-stage registration process and am a little unsure of the best practice for the steps of the script ...

There are 4 forms / pages in registration. Do I have to go through the set when and then 4 times in one scenario or is there a better way to organize it?

As long as I have ...

Scenario: Company User
Given I am on the registration page
When I follow "Register as a supplier"
When I fill in the following:
  | user_email | test@test.com |
  | user_password | secret |
  | user_password_confirmation | secret |
And I press "Create login - Proceed to step 2"
Then I should see "Create Company Profile"
When I fill in the following:
  | company_name | Test Company |
  | company_description | Lorem |
  | company_telephone | 01928740436 |
  | company_email | info@agency.com |
And I press "Create company - Proceed to step 3"
Then I should see "Test Company office(s)"
+5
source share
3 answers

I would recommend having 4 scenarios describing the details of each step, for example:

Given I am on step 2
When I fill in the following:
  | company_name | Test Company |
  | company_description | Lorem |
  | company_telephone | 01928740436 |
  | company_email | info@agency.com |
And I press "Create company - Proceed to step 3"
Then I should see "Test Company office(s)"

You can hide any necessary but inappropriate filling out the form in the definition of "Given that I am in step X".

You probably also have a script that covers all combinations, for example:

When I complete step 1 with valid information
And I complete step 2 with valid information
And I complete step 3 with valid information
And I complete step 4 with valid information
Then I should see "Thank you for registering"
+2
source

, , , 1, 2 .. :

When I register as a supplier with valid information
And I create company profile with valid information
And I ... with valid information
And I ... with valid information
Then I should see "Thank you for registering"
+5

I like the proposal of Mark Irwin - one of the basic concepts of automation of cucumbers is to write steps that are most understandable to the reader. It should be absolutely clear what the test does even for a person who is not a programmer at all.

If you are interested in this, you can also read “The Good Wynn” “Cucumber Book - Behavior Designed for Testers and Developers” for more effective practice.

Regards, Alex

+1
source

All Articles