0.14.2
Latest feature and fixes for Data Catering include:
- Simplified API for creating HTTP and message fields
- More powerful data validations (distinctInSet, isIncreasing/Decreasing, matchJsonSchema, and more)
- JSON Schema for Data Caterer YAML
- Consistent naming convention for all data sources, changing
column
tofield
- Validate HTTP responses
- More accurate timing of HTTP request and response
- Fix bug when field options defined as non-string get ignored by data generator
Simplified API for creating HTTP and message fields
Previously, you had to hand-craft specific fields and their options to create HTTP and message fields. This was error-prone and time-consuming. Now, you can use helper methods to create these fields with ease.
Follow the new steps found in the:
More powerful data validations
A large overhaul of the data validation API has been made to make it more powerful and easier to use.
Instead of having two separate methods for each validation, you can now use a single method with a negate flag to
invert the validation. For example, isNotNull
is now isNull(true)
.
You can also now define a field with a list of validations you want to apply to it for YAML. It now saves you from having to define the same field multiple times with different validations.
- Updates
...Col
->...Field
(i.e.isEqualCol
->isEqualField
)isNot...
->is...(negate)
(i.e.isNotNull
->isNull(true)
)not...
->...(negate)
(i.e.notStartsWith("a")
->startsWith("a", true)
)equalToOr...
->...(strictly)
(i.e.equalToOrLessThan(10)
->lessThan(10, false)
)notIn("a", "b")
->in(List("a", "b"), true)
upstreamValidation...withValidation(...)
->upstreamValidation...validations(...)
- New
matchesList(regexes, matchAll, negate)
hasTypes(types, negate)
distinctInSet(set, negate)
distinctContainsSet(set, negate)
distinctEqual(set, negate)
maxBetween(min, max, negate)
meanBetween(min, max, negate)
medianBetween(min, max, negate)
minBetween(min, max, negate)
stdDevBetween(min, max, negate)
sumBetween(min, max, negate)
lengthBetween(min, max, negate)
lengthEqual(value, negate)
isDecreasing(strictly)
isIncreasing(strictly)
isJsonParsable(negate)
matchJsonSchema(schema, negate)
matchDateTimeFormat(format, negate)
mostCommonValueInSet(values, negate)
uniqueValuesProportionBetween(min, max, negate)
quantileValuesBetween(quantileRanges, negate)
Validate HTTP responses
Now you can validate the HTTP response status code, body and headers. This is useful when you want to ensure that the response from the HTTP request is as expected.
var httpTask = http("my_http", Map.of(Constants.VALIDATION_IDENTIFIER(), "POST/pets"))
.fields(
...
)
.validations(
validation().field("request.method").isEqual("POST"),
validation().field("response.statusCode").isEqual(200),
validation().field("response.timeTakenMs").lessThan(100),
validation().field("response.headers.Content-Length").greaterThan(0),
validation().field("response.headers.Content-Type").isEqual("application/json")
)
val httpTask = http("my_http", options = Map(VALIDATION_IDENTIFIER -> "POST/pets"))
.fields(
...
)
.validations(
validation.field("request.method").isEqual("POST"),
validation.field("response.statusCode").isEqual(200),
validation.field("response.timeTakenMs").lessThan(100),
validation.field("response.headers.Content-Length").greaterThan(0),
validation.field("response.headers.Content-Type").isEqual("application/json"),
)
In docker/data/custom/validation/http/http-validation.yaml
:
name: "http_checks"
dataSources:
my_http:
- options:
validationIdentifier: "POST/pets"
validations:
- expr: "request.method == 'POST'"
- expr: "response.statusCode == 200"
- expr: "response.timeTakenMs < 100"
- expr: "response.headers.Content-Length > 0"
- expr: "response.headers.Content-Type == 'application/json'"
- Open
Validation
- Click on
Manual
checkbox - Click on
+ Validation
button and clickSelect validation type
and selectField
- Enter
request.method
in theField
text box - Click on
+
next toOperator
and selectEqual
- Enter
POST
in theEqual
text box - Continue adding validations for
response.statusCode
,response.timeTakenMs
,response.headers.Content-Length
andresponse.headers.Content-Type