This plugin uses XRay to automate testing of XQuery in Marklogic
This plugin requires Grunt ~0.4.2
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install https://github.com/rlouapre/xray-runner/tarball/v0.1.3 --save-devOnce the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-xray-runner');In your project's Gruntfile, add a section named xray_runner to the data object passed into grunt.initConfig().
grunt.initConfig({
xray_runner: {
all: {
settings: {
/* https://github.com/mikeal/request#http-authentication */
auth: {
username: 'admin',
password: 'admin',
sendImmediately: false
},
url: 'http://localhost:9999',
testDir: 'test',
files: ['test/**/*.xqy']
}
}
}
});Type: String
Base url of ML application server (XRay must be installed and available in {settings.url}/xray directory).
Type: String
Default value: test
Directory name where unit test are located.
Type: String Array
Unit test files to execute (support matching globbing pattern).
In this example, the plugin will execute all XRay tests located on server http://localhost:9999/test.
grunt.task.loadTasks('xray-runner/tasks')
grunt.initConfig({
xray_runner: {
all: {
settings: {
/* https://github.com/mikeal/request#http-authentication */
auth: {
username: 'admin',
password: 'secret',
sendImmediately: false
},
url: 'http://localhost:9999',
testDir: 'test'
}
}
}
});In this example, the plugin will execute only XRay tests located in test/test1.xqy on server http://localhost:9999/test.
grunt.task.loadTasks('xray-runner/tasks')
grunt.initConfig({
xray_runner: {
all: {
settings: {
/* https://github.com/mikeal/request#http-authentication */
auth: {
username: 'admin',
password: 'secret',
sendImmediately: false
},
url: 'http://localhost:9999',
testDir: 'test',
files: ['test/test1.xqy']
}
}
}
});In this example, the plugin is combined with watch so the tests are executed whenever XQuery files are changed.
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.task.loadTasks('xray-runner/tasks')
grunt.initConfig({
// Watch xqy files and execute xray-runner when they are modified
watch: {
options: {
spawn: false,
},
files: ['modules/**/*.xqy', 'test/**/*.xqy'],
tasks: ['xray_runner']
},
xray_runner: {
all: {
settings: {
/* https://github.com/mikeal/request#http-authentication */
auth: {
username: 'admin',
password: 'secret',
sendImmediately: false
},
url: 'http://localhost:9999',
testDir: 'test',
files: ['test/**/*.xqy']
}
}
}
});In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
(Nothing yet)