Populate XSpec with XSLT, Input XML and Output XML dynamically from an external file

21 views
Skip to first unread message

Antima Jain

unread,
Apr 28, 2021, 10:42:57 AM4/28/21
to XSpec
Hi Team,

We are exploring options for XML unit testing in my project.

Is it possible to populate my xspec file with transformation xslt, input xml and output xml dynamically from an external file with contents as below.

e.g. - if I have a list of files based on number of entries below - 

<Trans1>
   <files>
      <input>input.xml</input>
      <output>output.xml</output>
      <xsl>test_md.xsl</xsl>
   </files>
   <files>
      <input>input.xml</input>
      <output>output.xml</output>
      <xsl>dummy2.xsl</xsl>
   </files>
</Trans1>

Can I fetch the entries one by one in same xspec file?

Any help would really be appreciated.

Thanks,
Antima

AirQuick

unread,
May 3, 2021, 4:33:39 AM5/3/21
to xspec...@googlegroups.com

So you want to test every <xsl> in <files> when you expect each <xsl> to transform <input> into <output>?
That is not possible out of the box. One .xspec file is designed to test only one .xsl file.

You probably need to generate one .xspec file for each <xsl>:


test-001.xspec

<x:description stylesheet="test_md.xsl">
  <x:scenario label="test_md.xsl should transform input.xml">
    <x:context href="input.xml" />
    <x:expect label="into output.xml" href="output.xml" />
  </x:scenario>
</x:description>


test-002.xspec

<x:description stylesheet="dummy2.xsl">
  <x:scenario label="dummy2.xsl should transform input.xml">
    <x:context href="input.xml" />
    <x:expect label="into output.xml" href="output.xml" />
  </x:scenario>
</x:description>


test-003.xspec
...


Thanks,
AirQuick

Reply all
Reply to author
Forward
0 new messages