Altought there is several good JavaScript fake data generator,
but using these in k6 tests has several disadvantages (download size, memory usage, startup time, etc).
The xk6-faker implemented as a golang extension, so tests starts faster and use less memory.
The price is a little bit smaller feature set compared with popular JavaScript fake data generators.
For convenience, the xk6-faker API resembles the popular Faker.js.
The category names and the generator function names are often different
(due to the underlying go faker library),
but the way of use is similar.
Example
For convenient use, the default export of the module is a Faker instance,
it just needs to be imported and it is ready for use.
The reproducibility of the test can also be achieved using the default Faker instance,
if the seed value is set in the XK6_FAKER_SEED environment variable.
Random fake data generator for k6.
Altought there is several good JavaScript fake data generator, but using these in k6 tests has several disadvantages (download size, memory usage, startup time, etc). The xk6-faker implemented as a golang extension, so tests starts faster and use less memory. The price is a little bit smaller feature set compared with popular JavaScript fake data generators.
For convenience, the xk6-faker API resembles the popular Faker.js. The category names and the generator function names are often different (due to the underlying go faker library), but the way of use is similar.
Example
For convenient use, the default export of the module is a Faker instance, it just needs to be imported and it is ready for use.
For a reproducible test run, a random seed value can be passed to the constructor of the Faker class.
Output (formatted as JSON value)
The reproducibility of the test can also be achieved using the default Faker instance, if the seed value is set in the
XK6_FAKER_SEED
environment variable.then
Output (formatted as JSON value)