September 2018
Intermediate to advanced
398 pages
9h 43m
English
We want to check not only the HTTP status but the content received back; for example, for the list of products, we would like to make sure that we are receiving all of the default products:
"list all the products" in {
val response = wsClient.url(productsURL).get().futureValue
println(response.body)
response.status mustBe OK
response.body must include("PEPER")
response.body must include("NAO")
response.body must include("BEOBOT")
}
In this test, we look at the body of the response and make sure that the three default products are present.
Similarly, to check the add a product function, we first add the product, and then call the list of products:
"add a product" in { val newProduct = """ { "name" : "NewOne", ...Read now
Unlock full access