Writing BDD Stories in Gherkin is easy, but Conventions would help us scale -up and manage them much more effectively.
- Do not create too many feature files for each Jira story/task that you have, instead create feature files based on the functional aspects or features of your application. This will prevent proliferation of too many scenarios spread across too many story files.
- Define a unique parent tag for each feature file that you create. This will be used to run all the scenarios in this story file. Define the parent Meta Tag as per the following format - @PROJECTNAME_FEATURENAME
- Define a unique scenario-level Meta Tag as per the following format - @COMPONENT_FEATURE_TC<scenario-num> This will be used to run only the selected test-scenario from that story.
- Along with the Feature, we may also want to add a tag, for the Jira Story, if needed, like @JIRA_<jiraID>. This can come handy when we only want to run tests based on each Jira Story or Epic
- Define a common tag for different Category of tests, like @REGRESSION, @SMOKE, @API, etc. This will help run all the regression or smoke tests across different story files.
- Meta tags can be defined in upper or lower case, but upper case is preferred
- Do NOT use '-' in any of the meta tags. Using '-' in a tag name will actually not execute that test scenario
- Do NOT have spaces in between in any tag's name, use '_' instead
- Now, all my tests are not automated, and they wont run but they sure should be in the story files. So have additional tags for tests that are not automated, are still work in progress, or you just dont want to run, like below. [All these tags would be used to skip the tests]
- @SKIP - denotes that these tests should be skipped and not run at all when running the JBehave Stories.
- @MANUAL - denotes that the tests will not be automated, and have to be executed manually.
- @WIP - denotes that these tests are not ready to be run in an automated manner
- One of the reasons to include manual tests in the stories as well is to ensure that we have just one place to maintain all our tests, and its easier to report status.
Refer this post to put these conventions to use - How to use Meta Filters in JBehave
No comments:
Post a Comment