Use faker.js in Artillery loadtest configurations
npm install artillery-plugin-faker


Makes faker.js available for Artillery load test configurations.
> [!TIP]
> Artillery also provides a fake-data plugin (powered by falso).
> Use that for simple, integrated fake values — use this plugin when you need faker.js' full API, locale support, or specific faker functions.
``sh`
npm install -g artillery-plugin-faker
Add the plugin to your load test configuration:
`yaml`
config:
plugins:
faker:
locale: en
- locale (default: en) sets the locale of _faker.js_.
Using a string prefixed with $faker. as variable value will result in a random variable value returned by the indicated _faker.js_ function.
`yaml
config:
target: "http://localhost:3000"
phases:
- duration: 10
arrivalRate: 1
plugins:
faker:
locale: en
variables:
firstName: "$faker.person.firstName"
scenarios:
- flow:
- log: "Making request with query: {{ firstName }}"
- get:
url: "/search?q={{ firstName }}"
`
For a complete list of available _faker.js_ functions, have a look at the faker.js documentation. Please note that no parameters can be passed to the _faker.js_ functions at this time.
_Have a look at the example.yml file for a fully working example:_
`sh``
artillery run example.yml