Karunagara Pandi
Karunagara Pandi

Reputation: 644

How to practice with Xpath Match Assertion in SoapUI?

I have tested Contains Assertion without any issues but I don't know how to validate the webservices using Xpath Match Assertion in SoapUI.

Can you please tell me how to workout 'Xpath Match' Assertion in SoapUI?

I'm using JSON requests.

Updated: Please find the attachments

1) My JSON Response 2) Assertion Error message

Please tell me how to validate the identifier and please provide the correct XPath expression and Expected Results

enter image description here enter image description here

Thanks in advance!

Upvotes: 0

Views: 19874

Answers (1)

ITemius
ITemius

Reputation: 881

In XPath expression field you need to insert your XPath expression =) And in expected result field you need to insert expected result of applying your XPath expression to response of your request.

For example, if response contains something like this: [ { "id": "112", "username": "user1", }, { "id": "233", "username": "user2", } ]

and you want to verify, that response contains a user with id = 112, you need to add in XPath expression //id[text() = '112'] and in expected result - 112

In Soap UI pro you can use graphic wizard for creating XPath Match Assertion.

About XPath basics you can read here: http://www.w3schools.com/xpath/

Upvotes: 1

Related Questions