Skip to content

0.10.2 : Improve assertions

Compare
Choose a tag to compare
@agourlay agourlay released this 25 Nov 10:45
· 2639 commits to master since this release

Maintenance release containing a few renaming breaking changes and improvements regarding the assertions:

Breaking changes

  • GenericAssertion renamed to GenericEqualityAssertion
  • `show_last_response_bodyrenamed toshow_last_body``
  • show_last_response_body_as_json renamed to show_last_response_body_json
  • show_last_response_headers renamed to show_last_headers

Assertion redesign

The assertions have been redesigned to offer increase their reusability and expressiveness

There are now 4 types of assertions:

  • Equality : GenericEqualityAssertion, CustomMessageEqualityAssertion
  • Ordering : GreaterThanAssertion, LessThanAssertion, BetweenAssertion
  • Collection: CollectionEmptyAssertion, CollectionNotEmptyAssertion, CollectionSizeAssertion, CollectionContainsAssertion
  • String : StringContainsAssertion, RegexAssertion

Any of those assertion can be composed using and and or.
For instance, the BetweenAssertion is built by composition

LessThanAssertion(inspected, high) and GreaterThanAssertion(inspected, low) 

There are also a some of helpers on the Assertion companion objects.

Misc

  • support for Scala 2.12
  • new built-in extractor <random-alphanum-string>
  • add isNotEmpty on JsonArrayStep
Then assert body.asArray.isNotEmpty
  • fix a bug in the JSON array comparaison in case of duplicated element
  • fix a bug in the header session encoding
  • new debug instruction to show the full response
show_last_response
show_last_response_json
  • introduce new DSL block RepeatWith to repeat a series of step with different values
RepeatWith("Superman", "Superman", "GreenLantern", "Spiderman")("superhero-name") {

  When I get("/superheroes/<superhero-name>").withParams("sessionId"  "<session-id>")

  Then assert status.is(200)

  Then assert body.path("hasSuperpowers").is(true)
}
  • improve error reporting of wrapper steps with the initial nested error.