# Assertion of Multiple collection variables

**URL:** <https://community.postman.com/t/assertion-of-multiple-collection-variables/36116>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [June 10, 2022, 9:13am UTC](https://community.postman.com/t/assertion-of-multiple-collection-variables/36116 "2022-06-10T09:13:31Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![w4dd325](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/w4dd325/32/12436_2.png) [@w4dd325](https://community.postman.com/u/w4dd325)\
**Post date:** [June 16, 2022, 3:43pm UTC](https://community.postman.com/t/assertion-of-multiple-collection-variables/36116/4 "2022-06-16T15:43:33Z")

</div>

I tried to have a look but I just haven’t had the time to sit and play with it.  
And it’s quite new to me as I don’t do much with XML currently.

But here are 2 interesting posts that might help;

> [@How to assert xml response](https://community.postman.com/t/how-to-assert-xml-response/24634/11):
>
> I figured out how I can do it, here is an example var responseJson1 = xml2Json(pm.response.text()); console.log(responseJson1); pm.expect(pm.response.text()).to.include("sometext or tagname"); pm.expect(pm.response.text()).to.include(pm.variables.replaceIn('{{somevalue}}'));

> [@Issues converting a string containing xml to json](https://community.postman.com/t/issues-converting-a-string-containing-xml-to-json/23118/4):
>
> Ah OK, now I understand what you’re trying to do, thanks! The library that I’d normally use for this is [xml2js](https://www.npmjs.com/package/xml2js); I’d welcome somebody showing me a simpler solution, but in the meantime, this should do what you’re hoping for: var parseString = require('xml2js').parseString; parseString(the\_piece\_xml\_string, function (err, result) { pm.collectionVariables.set("the\_piece", JSON.stringify(result)); });tada Ta-da: xml2js has other configuration options if you want to more precisel…

If you get it working please do share the solution!!  
And if not I’ll try and find a bit of time to have a better look 👍

---

_[View the full topic](https://community.postman.com/t/assertion-of-multiple-collection-variables/36116)._
