Skip to content
Ragin666 edited this page Nov 26, 2022 · 25 revisions

Welcome to the bbd-cucumber-gherkin-lib wiki!

Basics

Here the possibilities for the configuration of the Cucumber BDD library are described. This includes things like:

  1. Default token configuration
  2. HTTP base path setup
  3. Proxy support
  4. SSL verification
  5. Database-less configuration

Comparison and extension with JSON-Unit

Answers can be validated with the help of JSON-Unit. In addition, there is the possibility to use matchers to simplify complex or repetitive validations or to make them more readable.

Partly there is a requirement to be more flexible with JSON responses, such as:

  1. Ignore additional fields in the response
  2. Ignore sorting of arrays
  3. Ignore additional array elements

This can be achieved using annotations or sentences.

Sentences

Some short hints before we start with the details:

  • If a path contains a template placeholder with ${} like ${elementFromContext} the library tries to replace this with elementFromContext in the context, if it exists.

  • Files can be added as relative path to a previously given base path or with an "absolute" path with the prefix absolutePath:. In the last case the system is using the base classpath as root.

Common

Given Sentences

Given sentences are intended to "take something for granted", i.e. to make preparations so that the actual test can be performed successfully afterwards.

As a rule, they are always the first step.

The "natural order" of Cucumber tests is Given -> When -> Then.

When Sentences

When sentences are primarily intended to perform something. That is, the majority of the When assigned records execute the calls to an API that were passed by Given records.

Then Sentences

The Then sentences are for evaluation after something has been executed with When.