cornichon v0.17.0 Release Notes
Release Date: 2019-02-19 // about 5 years ago-
β Property based testing support
π This is the big new feature of that release, a brand-new module to enable property based testing of
HTTP API
β It offers two flavors of testing, the classical
forAll
approach and a way to exploreAPI
interactions randomly.π For more information please refer to the documentation of the
cornichon-check
module: http://agourlay.github.io/cornichon/modules/module-check.htmlπ The release also contains the usual batch of breaking changes and improvements.
π₯ Breaking changes
DebugStep
now requires an explicit titleπ
ResourceStep
was moved tocom.github.agourlay.cornichon.steps.wrapped.ResourceStep
RepeatConcurrently
has an additionalparallelism
parameter to work as a stream processor.In the following example, the nested block will be executed 500 times by groups of 10 in a streaming fashion.
RepeatConcurrently(times = 500, parallelism = 10, maxTime = 10.seconds) { Given I get("https://github.com/agourlay/cornichon") Then assert status.is(200) }
JsonPath.run
now returns anOption
None
instead ofJNull
if the path is not present
- use
JsonPath.runStrict
to return an error if absentThe json body assertions are not conflating a null field with an absent field anymore.
given the following response body
{ βdataβ : null }
in
0.16.x
body.path(βdataβ).isAbsent
is correct
body.path(βdataβ).isPresent
is incorrectin
0.17.x
body.path(βdataβ).isAbsent
is incorrect
body.path(βdataβ).isPresent
is correctand additional matcher has been added for that case
body.path(βdataβ).isNull
AttachStep
/AttachAsStep
now requiresSession β List[Step]
instead of aList[Step]
- it enables
FlatMap-like
behavior.EffectStep.chainEffects
is gone because it promoted the direct usage of the effect function which breaks encapsulation and error reporting.- use
AttachStep
instead to bind steps together.
π Improvements
π new
ConcurrentlyStep
to perform a series of steps in parallelConcurrently(maxTime = 1.seconds) { Given I get("https://github.com/agourlay/cornichon") Given I get("https://github.com/agourlay/cornichon") }
π new assertions for the size of JSON arrays
body.asArray.size.isLesserThan(x) body.asArray.size.isGreaterThan(x) body.asArray.size.isBetween(x, y)
π improve error reporting and logging for
cornichon-test-framework
- the final message reported now contains the full log
- ignored features will not create noise in the logs
π new
cats.EffectStep
which is not usingFuture
but interop with thecats-effects
Effect
insteadimport com.github.agourlay.cornichon.steps.cats.EffectStepval myTaskEffect = EffectStep("identity task", s =\> Task.now(Right(s)))
β add oscillation detection to
Eventually
in order to fail if the final successful state is not reached with oscillation of errors.Given I send_async_command_updating_search_indexEventually(maxDuration = 1.seconds, interval = 100.ms, oscillationAllowed = false) { Given I search_for_new_state Then assert status.is(200) }
π Here, an oscillation could be seen in the status with something like
404 -> 500 -> 404 -> 200
.
β The oscillation detector would fail the test because of the404
oscillation.This flag can come in handy when dealing with eventually consistent system that should converge to a final state without oscillation.
β‘οΈ Dependency updates
- monix 3.0.0-RC2
- cats 1.6.0
- circe 0.11.1
- http4s 0.20.0-M5
- π§ moved from
ficus
toPureConfig
to manage configuration