Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge step-definition files and merge anti-patterns #50

Merged
merged 16 commits into from
Oct 28, 2017
Merged

Conversation

mlvandijk
Copy link
Member

As suggested in the todos (see #25), I've merged 2 files about step-definitions and also merged 2 files about anti-patterns.
In addition, I've (tried to) generalize these documents and add text/examples for Ruby/Java/Javascript where relevant.

Next steps:

  • merge step-definitions with step-organization
  • possibly merge anti-patterns with step-definitions also (although the file would become very long)...

source: https://github.com/cucumber/cucumber/wiki/Feature-Coupled-Step-Definitions-(Antipattern)/
source: https://github.com/cucumber/cucumber/wiki/Conjunction-Steps-(Antipattern)/
source: https://stackoverflow.com/questions/22696646/how-to-call-a-step-from-another-step-in-cucumber-jvm
source: https://groups.google.com/forum/#!searchin/cukes/jvm$20steps$20programming/cukes/DzE_kGZx94I/5rf__N31qvAJ
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A question about the YAML front-matter: Will repeating keys overwrite the last one in the system we're using?

In the Jekyll YAML Frontmatter documentation, a mention is made of categories, which can be specified as a YAML list.

If we're not programmatically using the source key, perhaps we can change it to a YAML list sources (plural):

sources:
  - https://github.com/cucumber/cucumber/wiki/Feature-Coupled-Step-Definitions-(Antipattern)/
  - https://github.com/cucumber/cucumber/wiki/Conjunction-Steps-(Antipattern)/
  - https://stackoverflow.com/questions/22696646/how-to-call-a-step-from-another-step-in-cucumber-jvm
  - https://groups.google.com/forum/#!searchin/cukes/jvm$20steps$20programming/cukes/DzE_kGZx94I/5rf__N31qvAJ

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@olleolleolle Tbh I don't actually know. I figured I'd list the sources that I'd merged into the documents. I'd be happy to do so differently if needed...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sources front matter is not programatically used at all - it was just a way of keeping track of which page the new pages were coming from.

Might make more sense to leave it as source but a list, and then test it for list / url if we ever use it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And probably no need to list sources in the same repo.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this makes sense to me.

This note of mine - A low-priority thing and “for later”, not blocking this change at all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this as is for now.

@mlvandijk
Copy link
Member Author

Updated Javascript version with information from @charlierudolph

Copy link
Contributor

@plaindocs plaindocs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of small comments, overall great stuff.

Then I should see "Cucumber BDD tool" under "Descriptions"
```

```java
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a better way of doing this, without overriding the code block for text content. Will investigate.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 +{{% text "java" %}} Cucumber will raise an `AmbiguousStepDefinitionsException`,{{% /text %}}
 +{{% text "javascript" %}}the Step / Scenario will get an "Ambiguous" result,{{% /text %}}
 +telling you to fix the ambiguity.

kinda stuff?

Copy link
Member Author

@mlvandijk mlvandijk Oct 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

end
```

### How to fix
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How to fix what exactly?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, how to decouple feature and step defenitions? Might be clearer to state explicitly?

source: https://github.com/cucumber/cucumber/wiki/Feature-Coupled-Step-Definitions-(Antipattern)/
source: https://github.com/cucumber/cucumber/wiki/Conjunction-Steps-(Antipattern)/
source: https://stackoverflow.com/questions/22696646/how-to-call-a-step-from-another-step-in-cucumber-jvm
source: https://groups.google.com/forum/#!searchin/cukes/jvm$20steps$20programming/cukes/DzE_kGZx94I/5rf__N31qvAJ
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And probably no need to list sources in the same repo.

source: https://stackoverflow.com/questions/22696646/how-to-call-a-step-from-another-step-in-cucumber-jvm
source: https://groups.google.com/forum/#!searchin/cukes/jvm$20steps$20programming/cukes/DzE_kGZx94I/5rf__N31qvAJ
title: Anti-patterns
polyglot: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing 'menu: reference`

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added


The specific preposition/adverb used has **no** significance when Cucumber is registering or looking up Step Definitions.

Also, check out Multiline [Step Arguments](/gherkin/gherkin-reference/#step-arguments) for more info on how to pass entire tables or bigger strings to your Step Definitions.


## Successful Steps
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth putting all of these under a heading saying that they are the various states of steps, what do you think?


{{% text "ruby" %}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this one is surplus?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I think this may be Ruby specific which is why I tagged these 2 paragraphs as "Ruby". If I'm mistaken, it should be updated.

@@ -178,3 +194,4 @@ Given /Three (.*) mice/ do |disability|
# some other code..
end
```
{{% /text %}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this one?

Copy link
Member Author

@mlvandijk mlvandijk Oct 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous comment; AFAIK this functionality is Ruby specific

@@ -165,7 +181,7 @@ So if you try `--guess` with the mice above, Cucumber will pick `/Three blind (.

## Redundant Step Definitions

In Cucumber, you're not allowed to use a `Regexp` more than once in a Step Definition—even across files, and even with different code inside the Proc.
In Cucumber, you're not allowed to use a `Regexp` more than once in a Step Definition—even across files, and even with different code inside the method or function.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this Regexp specific cucumber use of regular expression? if not we should just use Regular Expression

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not actually sure... The use of "Regexp' was fairly consistent throughout the docs, so I figured I'd keep it like that. I did mention "Regular Expressions (Regexp)" somewhere near the top of the docs. Could be updated separately if we want?

@mlvandijk mlvandijk merged commit fa563a1 into master Oct 28, 2017
@mlvandijk mlvandijk deleted the WIP-todos branch October 28, 2017 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants