Releases: Ragin-LundF/bbd-cucumber-gherkin-lib
Release 1.18.0 - Support for flexible JSON comparison
Release 1.18.0
Configure the JSON compare to ignore extra elements in arrays
Scenario:
Given that the response JSON can contain arrays with extra elements
It is also possible to use the @bdd_lib_json_ignore_new_array_elements
annotation on Feature
or Scenario
level.
With this sentence or annotation, the JSON comparison will ignore new array elements.
See src/test/resources/features/flexible_json/ for examples.
Configure the JSON compare to ignore the order of arrays
Scenario:
Given that the response JSON can contain arrays in a different order
It is also possible to use the @bdd_lib_json_ignore_array_order
annotation on Feature
or Scenario
level.
With this sentence or annotation, the JSON comparison will ignore the order of arrays.
See src/test/resources/features/flexible_json/ for examples.
Configure the JSON compare to ignore extra fields
Scenario:
Given that the response JSON can contain extra fields
It is also possible to use the @bdd_lib_json_ignore_extra_fields
annotation on Feature
or Scenario
level.
With this sentence or annotation, the JSON comparison will ignore new/not defined fields in the response.
See src/test/resources/features/flexible_json/ for examples.
Release 1.17.0 - Simplified sentences and better file handling
Absolute file path support
Files can be added as a 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.
Validate response HTTP code and body together
Scenario:
Then I ensure that the response code is 201 and the body is equal to
"""
{
"field": "value",
}
"""
In this case, the response status code is part of the sentence, and the JSON is written directly under the sentence and enclosed in three double quotation marks.
Here it is also possible to use JSON Unit syntax to validate dynamic elements.
Validate response HTTP code and body together with a JSON file
Scenario:
Then I ensure that the response code is 200 and the body is equal to the file "response.json"
In this case, the response status code, and the JSON file are written together in one sentence.
Here it is also possible to use JSON Unit syntax to validate dynamic elements.
Release 1.16.0
- Changing the body manipulation with creating numbers from
<number> characters
to<number> bdd_lib_numbers
(e.g.10 bdd_lib_numbers
). - Adding
bdd_lib_uuid
to generate random UUIDs - Adding a
${json-unit.matches:isValidUUID}
which checks, if the string is a valid UUID - Fixed Authorization header, that this header is only available once when it is overwritten
- Adding a lot of tests as examples
Release 1.15.0
Adding support in the paths to support templates.
If the path contains something like:
/api/v1/${dynamicElement}/
In this case, the dynamicElement
will be replaced, if it exists in the ScenarioContext.
Support for adding static key/value pairs to the context:
Release 1.14.0: Adding JSON Path support to the "I set the value" sentence
Release 1.14.0
Adding support for the JSON path to the "I set the value of" sentence.
It now also tries to resolve the value from the ScenarioContext.
If nothing is found, it uses the original value.
Release 1.13.0: Adding support for JSON path to the "I store" sentence.
Adding support for JSON path to the "I store" sentence.
The JSON path can be used with:
$.firstElement[3].nextElement
The library detects if the path has the prefix $.
. If it is not available, it adds this prefix.
Adding support for header manipulation
- Adding support for adding and manipulating headers.
- Restructured the documentation: HTTP Methods have now their own md files.
Adding new JSON Unit matcher and support for custom matchers
- Adding support for JSON matcher which can compare to values in the ScenarioContext.
More information: README.md#json-unit - Adding support for own custom matcher.
More information: README.md#extension-of-json-unit-matcher
Transitive dependencies for Cucumber
This release adds transitive dependencies for:
- 'org.apache.httpcomponents:httpclient'
- 'org.glassfish:javax.json:1.1.4'
- 'net.javacrumbs.json-unit:json-unit:2.18.1'
- 'io.cucumber:cucumber-java:6.2.2'
- 'io.cucumber:cucumber-spring:6.2.2'
- 'io.cucumber:cucumber-junit:6.2.2'
- 'javax.validation:validation-api:2.0.1.Final'
Release 1.9.0: Correction of a sentence
- Correction of the sentence
^that the body of the response is$
to^that the body of the request is$