Re: XProc testing; mock steps and v.next

I agree with Florent, configuration of mock objects would be the responsibility of the test framework. I know that XProc itself can be used to describe tests, but imho we'd be better served with a dedicated syntax, à la XProc test suite or even better XSpec for XProc.

An XProc-based implementation of XSpec-for-XProc could indeed use p:delete and p:insert with px:eval to modify the tested XProc at runtime.

Romain.



On 19 mars 2013, at 18:39, Jostein Austvik Jacobsen <josteinaj@gmail.com> wrote:

> Yeah, I guess it's ok for unit tests, but it would be cool if it were implementation-independent.
> 
> Alternatively, with dynamic evaluation you could p:delete the p:import statements and p:insert new p:import statements.
> 
> Jostein
> 
> 
> On 19 March 2013 17:45, Florent Georges <fgeorges@fgeorges.org> wrote:
>   Hi Jostein,
> 
>   An idea would be to use a URI resolver on your implementation (which
> would make it implementation-dependent, but that is probably OK for
> unit tests).  Your URI resolver could be configured or driven by some
> XML of course...
> 
>   Regards,
> 
> --
> Florent Georges
> http://fgeorges.org/
> http://h2oconsulting.be/
> 
> 
> On 19 March 2013 16:23, Jostein Austvik Jacobsen wrote:
> > So I've been fiddling with testing some XProc steps lately, and realized
> > that there's no way (afaik) to create a "mock step" without editing either
> > the step you want to test or the XML catalog. So it's not possible to do
> > unit testing in XProc; only integration testing.
> >
> > I think it would be useful to be able to override a URI that is already
> > defined in a XML catalog. Say I want to test the following step:
> >
> > <p:declare-step type="x:mystep" xml:base="file:/tmp/mystep.xpl" ...>
> >     <p:import href="http://www.example.com/mydependency.xpl"/>
> >     ...
> > </p:declare-step>
> >
> > But I don't want x:mystep to invoke http://www.example.com/mydependency.xpl
> > as it might produce non-deterministic side-effects. What if I could do
> > something like this to override the XML catalog:
> >
> > <x:mystep>
> >     <p:resource name="http://www.example.com/mydependency.xpl"
> > uri="mockdependency.xpl"/>
> > </x:mystep>
> >
> > The Resource Manager page on the v.next wiki[1] isn't very detailed yet but
> > maybe it will be possible to do something like this with the planned
> > resource manager?
> > [1] http://www.w3.org/wiki/XProc_Resource_Manager
> >
> > (another thing that would make XProc testing easier would be dynamic
> > pipeline execution; p:evaluate/cx:eval)
> >
> > Jostein
> 

Received on Tuesday, 19 March 2013 18:00:39 UTC