Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

Excerpt

Even when automating UI tests, it is important to keep your scenarios as readable as possible, or you threaten to lose all benefits from a plain-text approach.  In this post I’ll give you some tips that can help you with the basics.

1 Organize your features

Over the course of time you will probably end up having many features and scenarios.  Try to define features logically and avoid having very large feature files containing many scenarios.  Organize your features in separate folders.

...

Use Then to verify the outcome.

Use And and But

If you have multiple Given/When/Then statements you should combine them using And steps instead of repeating the same keyword over and over again.  This way the overall structure of your scenario remains more clear.  Consider the following example:

...

With only repeating And you get the following improved result:

keywords-good.png

Use * if you are not really testing anything at all

If you are not really writing a scenario but simply using CWB as a browser script runner, then it does not make much sense to use the Given/When/Then structure.  All you’re doing is executing steps in sequence.  In that case you can drop the keywords and start every step with a *.

...