From the course: API Test Automation with SoapUI

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Script assertions

Script assertions - SoapUI Tutorial

From the course: API Test Automation with SoapUI

Start my 1-month free trial

Script assertions

- [Instructor] We've looked at a number of the built-in assertions that SoapUI provides us, but sometimes we need to do something that isn't provided by default. In that case, we can use a Script Assertion. So I have here, this response from the date time API, and let's add a Script Assertion to it. So, we'll go to script, Script Assertion, add, and this brings up a script editor for us, that we can create our assertions in. So the first thing that we need is to get this response object. So we've got this response from a request. We somehow need to get that response object into our script. We can do this with something called the Message Exchange Variable. So let's create a variable. We'll call it response_message. And let me just make this a little bigger so we have more typing room. And we'll use the messageExchange and that gives us the resposneContent variable. So now we can read that response into our message. And just for the sake of figuring things out, let's log something out.…

Contents