Generates sets of data for fuzz testing.
- Generates sets of valid and invalid data that can be used to test JavaScript/TypeScript functions and REST APIs.
- Generates data from a JSON schema.
- CLI tool:
- Input a JSON schema in JSON or YAML format.
- Outputs JSON format.
Install it:
npm install -g fuzzmatic
Run it on a JSON schema:
fuzzmatic a-json-schema.json
Run it on a JSON schema in YAML format:
fuzzmatic a-json-schema.yaml
Generated data is output to the console.
Install it in your project:
npm install fuzzmatic
Require it in your code:
const fuzzmatic = require("fuzzmatic");
Load your JSON schema and generate data from it:
const fs = require("fs");
const schema = JSON.parse(fs.readFileSync("a-json-schema.json", "utf-8"));
const data = fuzzmatic.generateData(schema);
console.log(data);
If you want to load your JSON schema from a YAML file you need to install the YAML parser:
npm install yaml
Then load and parse the YAML file, before generating data from it:
const fs = require("fs");
const yaml = require("yaml");
const schema = yaml.parse(fs.readFileSync("a-json-schema.yaml", "utf-8"));
const data = fuzzmatic.generateData(schema);
console.log(data);
Clone it from GitHub:
git clone [email protected]:ashleydavis/fuzzmatic.git
Open folder in Visual Studio Code and hit Ctrl+Shift+B
Or
cd fuzzmatic
npm run compile
- Open in Visual Studio Code.
- Select 'Main' debug configuration.
- Select the 'Test All' or 'Test Current' debug configuration to debug all tests or the current test file.
- Set your breakpoints.
- Hit F5 to run.
Compile the application:
npm run compile
The run the compiled JavaScript:
npm start
Run the command line app directly:
npm run start:dev
Run tests directly:
npm test
Or:
npm run test:watch
See package.json for more scripts!