writing test cases for xquery

Issues related to W3C XQuery.
vkdev
Posts: 21
Joined: Sat Jan 07, 2017 12:54 am

writing test cases for xquery

Post by vkdev »

How do I write and automate tests in oxygen for xquery?
We connect to MarkLogic datasource.
Is any automation of testing possible?
Please advice how to go about it.
Thanks
alex_jitianu
Posts: 1007
Joined: Wed Nov 16, 2005 11:11 am

Re: writing test cases for xquery

Post by alex_jitianu »

Hi,

XSpec can be used to write test scenarios for both XSLT and XQuery (and from its documentation I see that it also supports MarkLogic). The latest release is 0.5.0.

Oxygen supports XSpec (mostly for XSLT but, to an extent also XQuery) so you can create and write XSpec scenarios in it. To run these scenarios from within Oxygen you will have to create an XProc scenario based on the details from the XSpec project (by default we only have scenarios for XSpec scripts that test XSLT).

Best regards,
Alex
vkdev
Posts: 21
Joined: Sat Jan 07, 2017 12:54 am

Re: writing test cases for xquery

Post by vkdev »

please can you point me to some documentation and examples of writing test cases?.
alex_jitianu
Posts: 1007
Joined: Wed Nov 16, 2005 11:11 am

Re: writing test cases for xquery

Post by alex_jitianu »

Hi,

Unfortunately I don't have much experience with writing tests fro XQuery. We only integrated the XSLT testing part into Oxygen. I think that what differs from an XSLT test is that you'll have to use the @query attribute on the root to refer the tested query.

Code: Select all

<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" query="myQueryTest.xqy">

<x:scenario label="Scenario for testing a function">
<x:call function="function-name"/>

<x:expect label="" select=""/>
</x:scenario>
</x:description>
Afterwards, to run it, you could try the XProc variant and make sure you select the MarkLogic driver. I recommend you to ask a question on the XSpec GitHub project. There was a recent surge in activity on the project and the people there can help you more than I can.

Best regards,
Alex
alex_jitianu
Posts: 1007
Joined: Wed Nov 16, 2005 11:11 am

Re: writing test cases for xquery

Post by alex_jitianu »

Hi,

I had the chance to talk with some guys from MarkLogic about unit testing. Although XSpec can test function calls, sometimes you need more, like creating an entire test infrastructure. They recommended using Roxyor XRay. Hope it helps...

Best regards,
Alex
Post Reply