Page 1 of 1

Xspec - why my test is failed?

Posted: Thu Oct 08, 2015 12:21 pm
by jvanhille
Hi,

I used to Xspec in Oxygen and I don't understand why my scenario is failed. Like you can see

My scenario :

Code: Select all

 
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" stylesheet="tests_common_ESM.xsl">
<x:scenario label="Conversion NOTE">
<x:scenario label="Scenario conversion NOTE élément">
<x:context href="fragment_xml_test/test_note.xml"/>
<x:expect label="résultat" href="fragment_xml_test/test_note_expected.xml"/>
</x:scenario>
<x:scenario label="Scenario conversion NOTE élément dans listItem">
<x:context href="fragment_xml_test/test_note2.xml"/>
<x:expect label="résultat" href="fragment_xml_test/test_note2_expected.xml"/>
</x:scenario>
</x:scenario>

Screenshot :
https://drive.google.com/file/d/0B-GRA1 ... sp=sharing

On the screenshot the xml result and the xml expected seems equal (all is green). I have just remark the difference that I put in yellow.

I had this problem when I put the xml outside of my scenario (in test_note.xml and test_note_expected.xml for example)

What do you think about it ?

Please don't hesitate if you need more informations.

Thanks in advance

Re: Xspec - why my test is failed?

Posted: Fri Oct 09, 2015 12:24 pm
by radu_pisoi
Hi,

I have investigated a bit the XSpec transformation and it seems that the cause why the test fails is that the type of the compared nodes is different. The result of the transformation is an element while the expected result is a document node.

A solution is to specify the select attribute on the expect element in order to select the root element of the expected result document.

Code: Select all

<x:expect label="résultat" href="fragment_xml_test/test_note2_expected.xml" select="/*"/>
Let me know if this solution works for you.

Re: Xspec - why my test is failed?

Posted: Fri Oct 09, 2015 12:31 pm
by jvanhille
Hi Radu,

It works.

Thank you very much.