Page 1 of 1

writing test cases for xquery

Posted: Wed Feb 01, 2017 12:50 pm
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

Re: writing test cases for xquery

Posted: Thu Feb 02, 2017 12:54 pm
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

Re: writing test cases for xquery

Posted: Fri Feb 03, 2017 1:04 pm
by vkdev
please can you point me to some documentation and examples of writing test cases?.

Re: writing test cases for xquery

Posted: Mon Feb 06, 2017 11:05 am
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

Re: writing test cases for xquery

Posted: Tue Feb 14, 2017 4:55 pm
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