writing test cases for xquery

Issues related to W3C XQuery.
vkdev
Posts: 21

writing test cases for xquery

Wed Feb 01, 2017 12:50 pm

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: 600

Re: writing test cases for xquery

Thu Feb 02, 2017 12:54 pm

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

Re: writing test cases for xquery

Fri Feb 03, 2017 1:04 pm

please can you point me to some documentation and examples of writing test cases?.
alex_jitianu
Posts: 600

Re: writing test cases for xquery

Mon Feb 06, 2017 11:05 am

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: 600

Re: writing test cases for xquery

Tue Feb 14, 2017 4:55 pm

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

Return to “XQuery”

Who is online

Users browsing this forum: No registered users and 0 guests