0.9 : Refactoring
This release contains several important internal refactorings that were necessary to fight the inherent complexity of a growing software.
A glimpse under the hood
Those internal refactorings were especially meant:
- to ease the design of custom steps by notably introducing the
RunState
concept to propagate the context - to start the ground work to remove
String
as an universable input for theHttpDsl
by introducing a new typeclass based abstraction calledBodyInput
- to offer different internal http clients in the future
All those changes will hopefully ease the introduction of new features in future releases.
This major version contains a couple of breaking changes which notably impact users relying on some helpers to build custom HTTP/JSON steps.
Breaking changes
- The
HttpService
as been simplified, instead of exposing one function per HTTP verb it promotesrequestEffect
as an entry point. TheHttpRequest
is built using the usual DSL.
def create_customer = EffectStep(
title = "create new customer",
effect = http.requestEffect(
request = HttpRequest.post("/customer").withPayload("someJson"),
expectedStatus = Some(201)
extractor = RootExtractor("customer")
)
)
whiteListing
renamed towhitelisting
in the DSL.SimpleStepAssertion
renamed toGenericAssertion
JsonMapper
moved fromcom.github.agourlay.cornichon.core to com.github.agourlay.cornichon.resolver
HttpService
session keys moved tocom.github.agourlay.cornichon.http.HttpService.SessionKeys._
- upgrade to Scalatest 3.0.0 (might be problematic if you were mixing other tests)
New features
- placeholders in steps's titles are now automatically resolved - #19
- graphQL JSON formatted strings can be used as input for the http steps - #60
import com.github.agourlay.cornichon.json.CornichonJson._
When I post("/superheroes").withBody(
gql"""
{
name: "Scalaman"
city: "Berlin"
}
""")
- new
containsString
assertion on body - #85
body.path("city").is("Gotham city")
body.path("city").containsString("Gotham")
baseUrl
can be overridden at the step level by passing the full URL - #84- add support for targetting element in a root array via JsonPath - #90
body.path("$[2]")
Misc
As always this release also contains various small improvements:
- make the error reporting as clear as possible
- documentation and examples