We are building a new experience for our SmartBear Community.
This site is now read-only. You can still browse and search as usual. Learn More
This site is now read-only. You can still browse and search as usual. Learn More
Hi,
Assuming you set your customerReference as a property somewhere convenient, propbably on the context variable e.g. context["customerReference"]="12345 (you could set this in a Groovy TestStep preceeding your request for example)
Then its as easy as inserting a property expansion into the request body e.g.
<GetCustRef ns: xxxx>
<message header ns: xxxx>
some stuff
</message header>
<request>
${customerReference}
</request>
</GetCustRef>
In terms of checking the results do you need any help with Assertions e.g. content, XPath or Script Assertions are obvious candidates to check XML response values? Note - you could also use property expansions in the Assertions if you have values that you wish to check for that are in properties...
Let me know if this fixes you up or you need any more help.
Cheers,
Rup
Thanks Rupert, will give that a go. It sounds like what I was after at least
In terms of checking the results, I was thinking it would be some kind of xpath? I currently have the data stored in a txt file as below so whatever option is easiest to check I guess
customerReference, name, active
12345, Bobs bits, Y
34567,Handy harry, N
Ok, no problem.
Assuming your service responds with XML, an XPath assertion is definately a good option (although I personally find XPath expressions awkward to work out!), a Contains Assertion would work too (but only checks for the content, whereas XPath is actually also checking exactly where the content is in the document) and Script Assertions are great as you can then use Groovy e.g. XML Slurper to check the response over.
When using any of the Assertions, remember that (assuming you have name and active read from your CSV file into properties) you can use these properties in the Expected Value / Content / Script with that same property expansion syntax e.g. ${name} and ${active}
That way your test case might look like:
1. Read line of CSV into properties (store on context)
2. Call service using properties from context as part of request body
2a. Have Assertions to use ${name} and ${active} to check the response data matches CSV expected data
3. Loop to next line of CSV or finish
Cheers,
Rupert
Thanks Rupert, all working nicely
No, problem - am glad you've got it all working now :-)
Cheers,
Rup