-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Here the possibilities for the configuration of the Cucumber BDD library are described. This includes things like:
- Default token configuration
- HTTP base path setup
- Proxy support
- SSL verification
- Database-less configuration
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:
- Ignore additional fields in the response
- Ignore sorting of arrays
- Ignore additional array elements
This can be achieved using annotations or 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 withelementFromContext
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.
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
.
- Setting User(s) and Bearer Tokens
- Set Base Path for Request/Result/Database Files
- Prepare and Reset the Context and set Static Values
- Header Manipulation
- REST URL and Request Body Preparation
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.
The Then
sentences are for evaluation after something has been executed with When
.