Version: unspecified
Severity: normal
Whiteboard: gci2013 https://www.mediawiki.org/wiki/Google_Code-In#Candidate_tasks
Description
Details
- Reference
- bz49876
Event Timeline
Cucumber step definitions[1] should be sorted alphabetically. This is how a definition looks like:
step_type(/^step name$/) do
- ruby code
end
Example (from visual_editor_steps.rb[2]):
Given(/^I am at my user page$/) do
visit(VisualEditorPage)
end
When /^I click Save page$/ do
on(VisualEditorPage).save_page_element.click
end
Then /^Page text should contain the string$/ do
@browser.text.should match Regexp.escape("Editing with #{@does_not_exist_page_name}")
end
Ruby code should be ignored. Steps should be grouped by type. "Given" steps should be grouped together, the same for "When" and "Then" steps. Inside the group, steps should be sorted alphabetically by step name.
For a good example on how steps should be grouped and sorted see aftv5_steps.rb[3] file.
1: https://github.com/wikimedia/qa-browsertests/tree/master/features/step_definitions
2: https://github.com/wikimedia/qa-browsertests/blob/master/features/step_definitions/visual_editor_steps.rb
3: https://github.com/wikimedia/qa-browsertests/blob/master/features/step_definitions/aftv5_steps.rb
Jeff, I have just noticed this bug and thought it would be a good task for code-in. :)
Since this is an easy task, I would suggest that it is done for all our repositories (about 10 of them) that contain step files[1]
I have just noticed that you are using this bug as documentation, please ignore the comment above.
maddiemadan wrote:
The [2] link is no longer working as the file has been removed from the repository
If you need more information (and you probably do), feel free to ask questions
here, at #wikimedia-qa freenode IRC channel or at QA mailing list:
Reopening, this bug is about implementing the convention, not documenting it. :)
Now that we have the document, I plan to update it and then we can have another task to implement the convention across all repositories.
I have wrote all conventions that I could think of here:
https://www.mediawiki.org/wiki/Manual:Coding_conventions/Cucumber