marmelab /gremlins.js

Monkey testing library for web apps and Node.js

★ 9,103⑂ 423👁 153⑃ 113● 87▤ 2
JavaScriptMITCreated 2013-10-21marmelab.com/blog/2020/06/02/gremlins-2.html
下载:Last release of 1.x.xLast-1.0.0 ↓1.0.02020-04-08
+1
日增长
9,103
stars
423
forks
153
watchers
113
prs
87
issues
2
releases

README

gremlins.js



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.



Generate bookmarklet | Install docs




















 Kate: _What are they, Billy?_

 Billy Peltzer: _They're gremlins, Kate, just like Mr. Futterman said._

 Table of Contents






- Purpose
- Installation
- Basic Usage
- Advanced Usage
  - Setting Gremlins and Mogwais To Use In A Test
  - Configuring Gremlins
  - Seeding The Randomizer
  - Executing Code Before or After The Attack
  - Setting Up a Strategy
  - Stopping The Attack
  - Customizing The Logger
  - Cypress
  - Playwright
- Docs
  - Issues
  - 🐛 Bugs
  - 💡 Feature Requests
- License




 Purpose

While developing an HTML5 application, did you anticipate uncommon user interactions? Did you manage to detect and patch all memory leaks? If not, the application may break sooner or later. If n random actions can make an application fail, it's better to acknowledge it during testing, rather than letting users discover it.

Gremlins.js simulates random user actions: gremlins click anywhere in the window, enter random data in forms, or move the mouse over elements that don't expect it. Their goal: triggering JavaScript errors, or making the application fail. If gremlins can't break an application, congrats! The application is robust enough to be released to real users.

This practice, also known as Monkey testing or Fuzz testing, is very common in mobile application development (see for instance the Android Monkey program). Now that frontend (MV\, d3.js, Backbone.js, Angular.js, etc.) and backend (Node.js) development use persistent JavaScript applications, this technique becomes valuable for web applications.

 Installation

This module is distributed via npm which is bundled with node and should be installed as one of your project's dependencies:


npm i gremlins.js


This library has dependencies listings for chance.

gremlins.js is also available as a bookmarklet. Go to this page, grab it, and unleash hordes on any web page.

 Basic Usage

A gremlins _horde_ is an army of specialized gremlins ready to mess up your application. _unleash_ the gremlins to start the stress test:

js
const horde = gremlins.createHorde();
horde.unleash();
// gremlins will act randomly, at 10 ms interval, 1000 times


gremlins.js provides several gremlin _species_: some click everywhere on the page, others enter data in form inputs, others scroll the window in every possible direction, etc.

You will see traces of the gremlins actions on the screen (they leave red traces) and in the console log:


gremlin formFiller input 5 in ​
gremlin formFiller input [email protected] in ​
gremlin clicker    click at 1219 301
gremlin scroller   scroll to 100 25
...


A horde also contains _mogwais_, which are harmless gremlins (or, you could say that gremlins are harmful mogwais). Mogwais only monitor the activity of 

Top issues

Latest release

Last release of 1.x.x 1.0.0 2020-04-08
The 1.x.x is already a legacy version. Check roadmap to 2.0.

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON