RE: Testing serialization options

Hi Norm,

Thanks for this, I think this is a really good start.

So if I understand your proposal correctly, the main pipeline returns
the base URI of the source document (that is, not the serialized one),
and the compare pipeline then finds the serialized document + the
expected result based on this base URI. Right now, the locations of the
files are hard coded in the compare pipeline, but perhaps this could be
generalized? I mean, in most cases I expect the compare pipeline to
always do about the same thing:

1. Take the source base URI
2. Extract the file name from the base URI and use it for locating the
serialized document in /tmp
3. Extract the file name from the base URI and use it for locating the
expected result document in ../serialization/results
4. Run serdiff

We could then move the compare pipeline to a separate file and just
import it using <p:compare-pipeline href="...">.

--

A related question: how do XSLT/XQuery test serialization? Do they at
all?

Regards,
Vojtech


> -----Original Message-----
> From: xproc-dev-request@w3.org 
> [mailto:xproc-dev-request@w3.org] On Behalf Of Norman Walsh
> Sent: Sunday, June 14, 2009 8:56 PM
> To: XProc Dev
> Subject: Testing serialization options
> 
> Hello implementors,
> 
> I've taken a stab at creating tests for a few of the serialization
> options. It's tricky because what needs to be tested is *the
> serialization of the result* and not the result itself. To that end,
> here's what the tests look like:
> 
> <t:test xmlns:t="http://xproc.org/ns/testsuite"
>         xmlns:p="http://www.w3.org/ns/xproc"
>         xmlns:c="http://www.w3.org/ns/xproc-step"
>         xmlns:err="http://www.w3.org/ns/xproc-error">
> 
> <t:title>Serialization test doctype-system-001</t:title>
> 
> <t:input port='source' href="../doc/s-input.xml"/>
> 
> <t:pipeline>
> <p:declare-step name="main">
>   <p:input port="source"/>
>   <p:output port="uri"/>
> 
>   <p:store href="file:///tmp/doctype-system-001.xml"
> 	   
> doctype-system="http://tests.xproc.org/tests/doc/s-input.dtd"/>
> 
>   <p:string-replace match="c:result/text()">
>     <p:input port="source">
>       <p:inline><c:result>uri</c:result></p:inline>
>     </p:input>
>     <p:with-option name="replace"
> 		   select="concat('&quot;',p:base-uri(/),'&quot;')">
>       <p:pipe step="main" port="source"/>
>     </p:with-option>
>   </p:string-replace>
> 
> </p:declare-step>
> </t:pipeline>
> 
> <t:compare-pipeline>
> <p:declare-step name="main">
> <p:input port="uri"/>
> <p:output port="result"/>
> 
> <p:exec name="diff"
> 	command="serdiff"
> 	source-is-xml="false"
> 	result-is-xml="false">
>   <p:input port="source"><p:empty/></p:input>
>   <p:with-option name="args"
> 	         select="concat('/tmp/doctype-system-001.xml ',
> 			        
> p:resolve-uri('../serialization/results/doctype-system-001.xml',
>                                               /c:result))">
>     <p:pipe step="main" port="uri"/>
>   </p:with-option>
> </p:exec>
> 
> <p:identity>
>   <p:input port="source">
>     <p:pipe step="diff" port="exit-status"/>
>   </p:input>
> </p:identity>
> 
> </p:declare-step>
> </t:compare-pipeline>
> 
> <t:output port="result"><c:result>0</c:result></t:output>
> 
> </t:test>
> 
> The way this works is like this:
> 
> 1. The main pipeline uses p:store to write the results into /tmp 
> 2. It passes that location to the compare pipeline
> 3. The compare pipeline uses serdiff to compare the serialized forms
> 
> You can find my very crude initial implementation of serdiff at
> http://tests.xproc.org/tests/bin/serdiff
> 
> The idea is that over time serdiff can grow to filter out the
> non-essential differences between outputs. Right now, it just does a
> straight compare.
> 
> Comments, thoughts, other implementors results against the
> serialization tests most welcome.
> 
> 
>                                         Be seeing you,
>                                           norm
> 
> -- 
> Norman Walsh <ndw@nwalsh.com> | Democracy consists of choosing your
> http://nwalsh.com/            | dictators, after they've told you what
>                               | you think it is you want to 
> hear.--Alan
>                               | Corenk
> 

Received on Monday, 15 June 2009 06:54:14 UTC