Grunt task for monkey testing library gremlins.js
This plugin requires Grunt ~0.4.0
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 grunt-gremlins --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-gremlins');
gremlins.js is a monkey testing library written in JavaScript, for Node.js and the browser. Use it to check the robustness of web applications by unleashing a horde of undisciplined gremlins.
In your project's Gruntfile, add a section named gremlins
to the data object passed into grunt.initConfig().
grunt.initConfig({
gremlins: {
options: {
// Task-specific options go here.
},
your_target: {
options: {
// Target-specific options go here.
}
},
}
});
Run this task with the grunt gremlins
command.
Task targets, files and options may be specified according to the grunt Configuring tasks guide.
Type: String
Path to local html page or external web page
Type: String
Path to js file with gremlins test
There are three formats you can use to run this task.
Grunt task:
gremlins: {
tests: {
options: {
path: './examples/basic.html'
}
}
}
./examples/basic.html:
<!doctype html>
<html lang="en">
<script src="../node_modules/gremlins.js/gremlins.min.js"></script>
<body>
<p>Lorem ipsum dolor sit amet.</p>
<script>
var horde = gremlins.createHorde()
.gremlin(gremlins.species.clicker());
if (window.phantomHorde) {
window.phantomHorde(horde, { nb: 20 });
} else {
horde.unleash({ nb: 20 });
}
</script>
</body>
</html>
Grunt task:
gremlins: {
local: {
options: {
path: './examples/basic.html',
test: __dirname + '/examples/test.gremlins.js'
}
}
}
/examples/test.gremlins.js:
var horde = gremlins.createHorde()
.gremlin(gremlins.species.clicker())
.gremlin(gremlins.species.scroller())
.mogwai(gremlins.mogwais.gizmo())
.mogwai(gremlins.mogwais.fps());
window.phantomHorde(horde, { nb: 20 });
Grunt task:
gremlins: {
local: {
options: {
path: './examples/basic.html'
}
},
external: {
options: {
path: 'https://google.com',
test: __dirname + '/examples/test.gremlins.js'
}
}
}