Forum Discussion
atlas
New Contributor
I get the same number of table elements for any request input (for any CountryCode).
Do you know, how can cdata be extracted and converted it to xml?
nmrao
9 years agoChampion Level 3
IMO, this is case does not suit for using Property Transfer step because of cdata or atleast I am not aware to get the value using PT Step. So, alternative is to use Script Assertion.
Add a script assertion to the first test step, and add the below code in it. Also disable or remove(step 2 property transfer becomes obselete in this case)
Script Assertion code:
/** * Below script extract the name from the first Table and * set its value into a test case level custom property called * COUNTRY_NAME **/ def holder = new XmlHolder(messageExchange.response.responseContent ) def countryCodeResult = holder.getNodeValue('//*:GetCountryByCountryCodeResult') log.info countryCodeResult def cdataHolder = new XmlHolder(countryCodeResult) def countryName = cdataHolder.getNodeValue("//Table[1]/name") assert countryName, "Country name is empty or null" context.testCase.setProperty('COUNTRY_NAME', countryName)
And in the next request where the country name is needed use ${#TestCase#COUNTRY_NAME}
Related Content
Recent Discussions
- 4 days agominhng