I'm somewhat new to automated testing and this is a general testing design question based on my current project: A client has a question/answer tool in Excel that is being ported over to a jekyll/javascript site.

Different questions lead to different answers, i.e. a decision tree. One such question/answer test has a large decision tree and as such, the cucumber feature file for this section is large (including comments, of which there are many, 1500 lines).

I don't have many java methods (i.e., there are only a handful of different gherkin lines). The feature files read like this:

When I read "some text here"
Then I answer "Yes"
When I read "this new text"
Then I answer "No"

And so on. I realize, because of the limited number of answers, I can replace

Then I answer "Yes" with

Then I answer Yes or Then I answer No

And at the end of these question/answer, the tool responds with a wall of text, many of which repeat (and some "fragments" are repeated in almost every scenario). So I can hard code the text fragments into page objects.

What I'm getting to, though: how do I improve upon this design? Even with the improvements (storing common phrases in methods), I have a feature file that is 1500 lines long (all the scenarios are related to one tool / "view"). The decision tree will have been extracted to yaml files, and I'm wondering if it would make sense to have minimal java methods and create scenarios from parsing the yaml? Or When each page object is created, read a yaml file with specific text that it should contain? As it is, I think my tests are brittle (i.e., have to be changed if the language of a question or answer is changed); but I have to test for specific language.

1 Answer 1


My recommendations are:

  • use page objects
  • do not store data/text that may change in methods/scenarios
  • create an object that handles data so that you are able to read from files
  • to avoid locale issues you can use some parameter to decide for what locale to read (reading can be done from different files for each locale or from the same file that contains an array with keys for each locale), if you have some data that is used on multiple locales i recommend to use a default case for reading.
  • if the same set of data is used in multiple scenarions need to be changed you should be able to do that from a single place
  • scenarios should be concise and easy to understand
  • keep it simple and efficient
  • create new steps that are useful for your project
  • review what BDD and page objects are and set some guidelines

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.