Where can I find out how best to use Gherkin tags? - cucumber

I've been using SpecFlow for my acceptance tests. This uses Gherkin (the DSL Cucumber uses). It includes an interesting feature called "tags". I can see the practicalities of its use, but am not sure about what might constitute good practice for using tags in BDD.
I have Googled around for help but unfortunately including the word "Tag" matches lots of non-Gherkin tags (like the ones on this page!)
I hoped to find some help on the Cucumber wiki but the Tags topic is not yet written.
I found the statement "you can use Tags to group features and scenarios together independent of your file and directory structure" but I'm afraid I don't know what that means!

This is a good link http://www.marcusoft.net/2010/12/using-tags-in-specflow-features.html

Related

Can all steps in feature file of cucumber be reusable across all feature files?

Can all steps in feature file of cucumber be reusable across all feature files?
Since each step phrase should be unique can it be reused across all feature files.
If not, Why it should not be?
In ruby Cucumber this is the default. A step defined anywhere in features/step_definitions can be used in any feature. Cucumber will detect when there is more than one step that matches and warn you about it.
In java things should be the same but inevitably the implementation is more complex. As I don't use java I'm afraid I don't know the details of how this is achieved.
Yes, step definitions are shared between features:
"Step definitions aren’t linked to a particular feature file or scenario. The file, class or package name of a step definition does not affect what Gherkin steps it will match. The only thing that matters is the step definition’s expression."
(Source: the docs)
In my opinion, this is one of the major benefits of using Cucumber.
In fact, using feature-coupled step definitions is considered an anti-pattern:
"Feature-coupled step definitions are step definitions that can’t be reused across features or scenarios.
This may lead to an explosion of step definitions, code duplication, and high maintenance costs."
(Source: the docs)

Cucumber feature file in an excel spreadsheet

I would like to know if it is possible to have an excel spreadsheet that contains Gherkin statements and then convert it to a cucumber feature file. I have looked extensively on the internet and I have not been able to find anything related to this. I did find some forums where it is mentioned that this may not be possible. I am pretty new to cucumber and I would like to know whether it can be done. I also found that with spec-flow (cucumber for .NET) it is possible. But I am using cucumber with Java.
I would appreciate it if someone can give me some guidance regarding this.
Thank you
I haven't seen any tool that support this.
To me, it sounds like you would need a pre-process that extracts the scenarios from their storage in an Excel file.
The answer to your question, "is it possible to have an excel spreadsheet that contains Gherkin statements and then convert it to a cucumber feature file" is yes. But I am not aware of any tool. You probably have to write it yourself.
We have done one implementation where we extracted all the scenarios from JIRA tool. The scenarios were the acceptance criteria and then copied same in Feature file.
To answer your question, we have not done so far, but you may need to write a separate code for same.

How do I build Watir tests for websites?

There is a repository of tests for the Mozilla addons site, although it's written using Selenium. I'd like to know if there are any real-world examples available for Watir, so I can see how the framework is implemented by professionals?
This is a more general question about how one goes about building a suite of tests for a website in Watir. On a superficial level, one can write a bunch of seperate .rb files with crude error reporting and fire them all off; but I'd like to know more about writing actual classes and proper test structures that raise issues and return reports. How is this done? Are there any books on this? Tutorials?
Check out WatirMelonCucumber - a set of watir-webdriver tests against google and bing, and also EtsyWatirWebDriver - a set of watir-webdriver tests against Etsy.com
The watir Wiki has a selection of tutorials, examples etc as well.
Start Here
Learning More
Wiki homepage
Those are however fairly basic and don't get into the 'how to organize things' level.
In that case there are a number of frameworks in various states of development. The most active ones are I think are perhaps Taza, and QA Robusta. Each of them approaches things a little differently. QA Robusta is wrapped a bit around Minitest (if I understand things right) and provides it's own reporting. I'm still learning about Taza so can't really comment on it much. I also recall hearing about a 'WatirSpash' gem/framework that was discussed in a recent watir podcast which is designed to help watir use along with RSpec (and I might presume Cucumber)
If you are a BDD/Spec-by-example sort, then you may want to use either (or both) RSpec or Cucumber perhaps in combination with the WatirSpash gem as a way to organize and describe you tests, and then implement the actual test code via Watir, In that case you would likely be using the HTML based reports that can be generated by RSpec/Cucumber instead of rolling your own or depending on a watir framework for the reporting.
More Watir frameworks:
https://github.com/jarmo/WatirSplash
https://cyberconnect.biz/opensource/qa_robusta.html
Not in active development:
https://github.com/scudco/taza
https://github.com/bret/watircraft
QA Robusta most likely will not have too many new features added but will be supported. Instead you may want to check out whirlwind. Whirlwind uses similar concepts as other frameworks such as qa_robusta and taza, but is lighter weight and tailored around cucumber/rspec. See the walk through for a google search example.

Using XText to create a DSL for describing proprietary XML-formats

At the moment, I have to work with XACML. As there doesn't seem to be an editor to fit my needs, and as writing documents in it is a real pain, I wonder if I could not create some sort of DSL to make creating documents easier (are less error-prone). Is this possible with XText? I have a feeling it's possible but quite hard to do (especially for someone who doesn't know XText ;-)).
Getting rid of manually edited XML files is a typical use case for Xtext. The tedious part is the syntax definition itself. As soon as you have an idea how your files should look like, it's usually straight forward to get a working prototype with Xtext. What sort of concerns do you have?

Generate class diagram from existing javadocs

I'm using an external java library for which I only have the javadocs and do not have the source code. I'd like to generate a UML diagram from the existing javadocs so that I can visualize the class hierarchy using something like Graphviz. Is that possible? Note that what I'm looking for is a graphical version of overview-tree.html.
Please let me know if you have any ideas and/or suggestions.
Thanks,
Shirley
I don't believe that there is such a tool. Most of the reverse engineer tools depend on the actual code. The javadoc information isn't guaranteed to match the code as a 1:1 for the structure, thus making it unreliable.
I'm not familiar with any off-the-shelf solution for this purpose. Most commonly folks have the source code that generated the JavaDoc.
That being said, the overview-tree.html traditionally has a fairly straightforward HTML format.
It should not be difficult to write a script that would read the file as text or as a DOM, reconstruct the hierarchy of UL and LI tags, and use that to build an input file for graphviz. I've done similar stuff in the past with other forms of data.
It's just a matter of time and proficiency with the scripting language or appropriate tools.
The one problem of this approach is that you would only get the hierarchy of classes. You would have to make it somewhat smarter if you wanted to get the "implements XYZ" and create multiple hierarchies. Even if you could get that data, you would have to manipulate GraphViz's levels to get it to provide an appropriate layout once you have this multiple inheritance structure.
Of course, adding the details of the members would turn this into a whole new problem since you will have to access other HTML files.

Resources