[Cucumber][Gherkin] Could you review this registration feature?

1,031 views
Skip to first unread message

Andrey Botalov

unread,
Jul 12, 2012, 8:10:18 PM7/12/12
to cu...@googlegroups.com
At project where I work there is registration form. I think it's difficult to review features not knowing what system they are about so I wrote it for similar Google registration (https://accounts.google.com/SignUp):

Problems I know about:
1. There are a lot of other scenarios about negative cases. Should they exist? Should they be here or in a separate feature? Note that there are probably a lot of other negative scenarios not written here.
2. Currently I plan to setup @error_message at automation layer. It will be retrieved using the same internationalization XML file used in code. Then it will be used in "Then I get an error message about it". Is it good? I did to remove duplication between code and features.
3. Scenario "Required fields are actually required" is used for different error messages so I should put some logic into automation layer. Will it be better to write different scenarios for different error messages?
4. Some steps have details that naturally aren't needed there (e.g. "Given I filled password at registration page." "registration page" isn't naturally needed here). I do this as there is no step definition scoping in Cucumber. I don't see how can I deal with steps "Given I filled password" at automation layer if there are many password fields at different pages.

Could you review this feature for other pitfails and express your opinion?

Andrew Premdas

unread,
Jul 13, 2012, 2:02:39 AM7/13/12
to cu...@googlegroups.com
A couple of points

Scenario descriptions should be consistent with the steps they use. So 

Scenario Outline: Valid format of date
...
Then I get an error message

Might be better as

Scenario Outline: Using invalid dates
...
Then I get an error message

In a similar way 

Scenario: Password and Password confirmation should be even

doesn't really make any sense.

https://github.com/diabolo/r3-mongo-devise is a sample app of mine that is an exercise in writing registration features. You might get some ideas from it.


(Apologies for linking to my stuff)


Using Cucumber to exhaustively test things i.e the validation of every form field on a page is generally a bad idea. This is better done by unit tests. In particular with validation in say a Rails app, alot of your tests end up re-testing validations in ActiveRecord which are 

1. Not your code
2. Already extensively tested.

Cucumber features are more appropriate for confirming key higher level business concerns e.g. I can register, When I make a mistake registering I get an error message. The details of the error message e.g. its text, position on screen, colour, emphasis etc are best confirmed by reviewing the functionality through the application. All this is highly dependent on context.

HTH

Andrew




-- Rules --
 
1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.
 
You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cu...@googlegroups.com. To unsubscribe from this group, send email to cukes+un...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en



--
------------------------
Andrew Premdas

Andrey Botalov

unread,
Jul 13, 2012, 6:50:02 AM7/13/12
to cu...@googlegroups.com
On Friday, July 13, 2012 9:02:39 AM UTC+3, apremdas wrote:
You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cu...@googlegroups.com. To unsubscribe from this group, send email to cukes+unsubscribe@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en



--
------------------------
Andrew Premdas


But:
Process of registration is multistage. What is better?

Given I am at second stage of registration
When I ...
Then go to third stage of registration


or just:

When I signup with [detail entered at step 2 of registration]

Andrey Botalov

unread,
Jul 13, 2012, 8:21:59 AM7/13/12
to cu...@googlegroups.com
This podcast describes writing features for registration page well 

Kfir Lavi

unread,
Jul 13, 2012, 10:52:47 PM7/13/12
to cu...@googlegroups.com

I think you forgot to include a url to the podcast...

-- Rules --
 
1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.
 
You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cu...@googlegroups.com. To unsubscribe from this group, send email to cukes+un...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en

Andrey Botalov

unread,
Jul 14, 2012, 5:00:48 AM7/14/12
to cu...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages