Skip to content

Releases: agourlay/cornichon

0.9.3 : Experimental HTTP mock

10 Oct 10:13
Compare
Choose a tag to compare

Maintenance release introducing the following changes:

Features & improvements

  • improved diff of collections (show added, deleted and moved elements).
  • removed extra curly brace in diff messages.
  • introduced HttpListenTo creates an HTTP server that will be running during the length of the enclosed steps.

By default this server responds with 201 to any POST request and 200 for all the rest.

The server records all requests received as a JSON array of HTTP request for later assertions.

There are two ways to perform assertions on the server statistics, either by querying the session at the end of the block or by contacting directly the server while it runs.

Refer to those examples for more information.

This feature is experimental and subject to changes.

0.9.2 : Better error reporting

25 Sep 12:45
Compare
Choose a tag to compare

Maintenance release introducing the following changes:

Features & improvements

  • add more details regarding failing requests in case of network errors.
  • improve error reporting formatting and cosmetics across the board.
  • avoid unecessary placeholders resolution if possible.
  • GenericAssertion abstract the diffability through a typeclass (all common instances provided).
  • introduce addToWithHeaders to add headers to the with-headers collection.

Breaking changes

  • the HttpService session keys variables are now lower-cased
  • AssertStep and GenericAssertion have been moved a package deeper to com.github.agourlay.cornichon.steps.regular.assertStep

0.9.1 : Revamp session assertions

07 Sep 12:20
Compare
Choose a tag to compare

Maintenance release introducing the following changes.

  • The session assertions have been redesigned to provide a unification with the JSON assertions which have been extracted for reuse - #86 .

You can now express the usual assertions available on the http body on any session key:

session_value("my-json-value").asJson.path("a.b.c").ignoring("d").is(...)

Two new helpers have also been added to test the existence of keys in the session:

  session_value("my-key").isPresent
  session_value("my-key").isAbsent
  • A bug concerning the definition of custom body type has been fixed - #93

This is an advance feature that still needs a better documentation - #92

0.9 : Refactoring

02 Sep 10:37
Compare
Choose a tag to compare

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 the HttpDsl by introducing a new typeclass based abstraction called BodyInput
  • 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 promotes requestEffect as an entry point. The HttpRequest 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 to whitelisting in the DSL.
  • SimpleStepAssertion renamed to GenericAssertion
  • JsonMapper moved from com.github.agourlay.cornichon.core to com.github.agourlay.cornichon.resolver
  • HttpService session keys moved to com.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

0.8.4 : Maintenance

15 Jul 12:59
Compare
Choose a tag to compare

Maintenance release introducing the following changes.

  • A configuration knob to run scenarios sequentially.
  • use the following in your application.conf
cornichon {
  executeScenariosInParallel = false
}
  • Fix error message occuring during resource cleanup at the very end of the run.

No breaking change to notice.

0.8.3 : Maintenance

11 Jul 12:07
Compare
Choose a tag to compare

Maintenance release introducing the following changes.

  • Improved unicode character handling in databale parser (contributed by @OlegIlyenko #81)
  • Internal blocking operations are now running on a different threadpool.

No breaking change to notice.

0.8.2 : Http breaking changes

30 Jun 09:49
Compare
Choose a tag to compare

Maintenance release introducing a couple of syntax breaking changes which can be fixed mechanically.

  • Http Dsl
    • post(url, payload) is now post(url).withBody(body)
  • Http Service
    • methods are not capitalized anymore
    • payload: String argument is replaced by body: Option[String]

As a side effect, all http verbs in the DSL have a similar builder, that means it is now possible to have a request body in http GET, HEAD and DELETE.

0.8.1 : Maintenance

18 Jun 18:39
Compare
Choose a tag to compare

Maintenance release introducing the following changes.

  • DSL structure changed : step statements are not limited to I, a, assert anymore.
  • New APIs on Http DSL's built-in steps : addHeaders and addParams without losing the existing values.
  • New bloc AttachAs which behaves like Attach but gives an additional label to the nested step execution.
Scenario("demonstrate DSL composition") {
  And assert superhero_exists("batman")
}

def superhero_exists(name: String) =
  AttachAs("superhero exists") {
    When I get("/superheroes/Batman")
    Then assert status.is(200)
  }

One breaking change to notice:

  • assert_not has been removed as it was impractical and badly designed. Please report any issues with this decision.

0.8.0 : Circe

13 Jun 12:23
Compare
Choose a tag to compare

This major version contains a couple of breaking changes which impact users relying on some helpers to build custom HTTP/JSON steps.

This migration should be transparent for users of the built-in steps through the DSL.

Breaking changes

  • The main topic of this release concerns the migration from Json4s + Spray-json to using solely Circe.
    • This change is visible if you rely on functions from CornichonJson and Session.getJson which now return Json objects instead of Jvalue.
  • The HttpService parameters received two changes
    • extractor is now designed as a data type instead of an Option. This change introduces a new feature, it is now possible to extract directly subpart of the response body using a Json path.
extractor = PathExtractor(path = "a.b.c[2].c", key = "my-key") 
  • expected renamed to expectedStatus for more clarity

New features

  • new bloc step WithDataInputs to repeat a series of steps with different inputs specified via a datatable.
WithDataInputs(
  """
    | a | b  | c  |
    | 1 | 3  | 4  |
    | 7 | 4  | 11 |
    | 1 | -1 | 0  |
  """
) {
  Then assert a_plus_b_equals_c   //custom step reading from session
}
  • add alias on BodyArrayAssertion isEmpty equivalent to hasSize(0)

Bug fixes

  • the Json path extraction was not 100% correct and could retrieve the wrong key - #38
  • errors occuring in afterEach were not properly aggregated - #75
  • build GraphQl payload only once

Misc

This release also contains various small improvements:

  • better log formatting
  • feedback regarding started scenario
  • documentation and examples

0.7.4 : Maintenance

31 May 09:49
Compare
Choose a tag to compare

Maintenance release upgrading internal dependencies and fixing the following issue.

  • the built-in helper for GraphQL query_gql could not accept json value for the variables. (contribution from @OlegIlyenko)

A few improvements:

  • better formatting and cosmetic improvements to the scenarios' logs dsiplay.
  • improved documentation in the readme file to highlight built-in steps.