Hi, I would like to validate the values of XML parameters but I faced some issues.
<VHBTV_CD:MediaAttributes>
<VHBTV_CD:MediaTrack>
<VHBTV_CD:SubTitle impairedHearing="true">FRE</VHBTV_CD:SubTitle>
</VHBTV_CD:MediaTrack>
</VHBTV_CD:MediaAttributes>
I can only validate the value of an attribute impairedHearing:
pm.expect(jsonObject[‘VHBTV_GRID’][‘ContentLocationTable’][‘TVContentLocation’][‘VHBTV_TV:AVAttributes’] [‘VHBTV_CD:MediaAttributes’][‘VHBTV_CD:MediaTrack’][‘VHBTV_CD:SubTitle’].$[‘impairedHearing’]).to.eql(‘true’);
I try to find out how to validate ‘SubTitle’ itself, so I print it to the console:
console.log(jsonObject[‘VHBTV_GRID’][‘ContentLocationTable’][‘TVContentLocation’][‘VHBTV_TV:AVAttributes’][‘VHBTV_CD:MediaAttributes’][‘VHBTV_CD:MediaTrack’][‘VHBTV_CD:SubTitle’])
- {_: “FRE”, $: {…}}
-
_: “FRE”
-
$: {…}
-
impairedHearing: “true”
The issue is related with {: “FRE”, $: {…}} - I have no idea how to deal with ':’
To sum up. I know how to validate the attribute but really don’t know how to validate the language of the subtitle.
Similar situation with genre:
<VHBTV_CD:GenreList>
<VHBTV_CD:Genre genreLabel=“Enfant - série”>BFT-003-005</VHBTV_CD:Genre>
</VHBTV_CD:GenreList>
I am able to validate the genreLabel:
pm.expect(jsonObject[‘VHBTV_GRID’][‘ContentTable’][‘VHBTV_CD:Content’][‘VHBTV_CD:GenreList’] [‘VHBTV_CD:Genre’].$[‘genreLabel’]).to.eql(‘Enfant - série’);
but no idea how to check the value of VHBTV_CD:Genre.
console.log(jsonObject[‘VHBTV_GRID’][‘ContentTable’][‘VHBTV_CD:Content’][‘VHBTV_CD:GenreList’] [‘VHBTV_CD:Genre’])
Thank you in advance for any tips