A lightweight Scala DSL for system testing REST web services
val Jason: Person = ???
val personJson = Json.stringify(Jason)
val EmptyList = List[Person]()
using(_ url "http://api.rest.org/person") { implicit rb =>
GET asserting (statusCode is Status.OK, jsonBodyAsList[Person] is EmptyList)
val id = POST body personJson asserting (statusCode is Status.Created) returning (header("X-Person-Id"))
GET / id asserting (statusCode is Status.OK, jsonBodyAs[Person] is Jason)
GET asserting (statusCode is Status.OK, jsonBodyAsList[Person] is Seq(Jason))
DELETE / id asserting (statusCode is Status.OK)
GET / id asserting (statusCode is Status.NotFound)
GET asserting (statusCode is Status.OK, jsonBodyAsList[Person] is EmptyList)
}
RestTest is licensed under the permissive Apache 2 Open Source License.