Questions tagged [faker]

An extension or library used in certain programming languages or frameworks (namely Ruby or Yii2) for generating fake data for debug purposes and testing.

In Ruby, Faker, a port of Data::Faker from Perl, is used to easily generate fake data: names, addresses, phone numbers, etc.

In Yii2, Faker can generate random strings (like name, address, phone number or anything), random numbers, keys or harshes as well as long sentences of fake text. It can be accessed in OOP style.

A PHP library is available for Faker that is used in some frameworks such as Laravel.

565 questions
6
votes
1 answer

Laravel Faker how to get min and max length for username

I want to get a min length of 1 and a max of 3. I have tried $faker->username(1,3); It's still producing usernames with higher lengths. Also how can I make it to only have letters? Sometimes it has periods in the username.
6
votes
1 answer

Maximum Limit of distinct fake data using Python Faker package

I have used Python Faker for generating fake data. But I need to know what is the maximum number of distinct fake data (eg: fake names) can be generated using faker (eg: fake.name() ). I have generated 100,000 fake names and I got less than 76,000…
Neron Joseph
  • 685
  • 7
  • 21
6
votes
4 answers

Using Python Faker generate different data for 5000 rows

I would like to use the Python Faker library to generate 500 lines of data, however I get repeated data using the code I came up with below. Can you please point out where I'm going wrong. I believe it has something to do with the for loop. Thanks…
Conrad Addo
  • 350
  • 3
  • 12
6
votes
4 answers

I18n::MissingTranslationData: translation missing: en.faker error when seeding db

I want to seed the database with Faker, the problem is that I am getting an error when I do a: rake db:reset I get this message: rake aborted! I18n::MissingTranslationData: translation missing:…
bntzio
  • 1,081
  • 12
  • 26
5
votes
1 answer

Custom faker provider for usage with factory boy and pytest

I am attempting to add some custom faker provider to use with factory_boy and pytest. I put the provider in faker_providers/foo.py/Provider. In my factories.py file, I have to import foo.py and then register by…
dephiros
  • 183
  • 1
  • 6
5
votes
1 answer

JSON.Parse Showing error at position 0 while parsing string to JSOn in Faker.js

I have seen these type of questions and tried the solutions but was not working. I am sending an array from UI to the controller, there I have the reference for faker.js in Node.js My code in controller: var FirstName = req.body; …
charan tej
  • 1,020
  • 10
  • 27
5
votes
2 answers

How to use faker.date.between faker.js

I want to generate some dates between two fixed values, but I don't know how to use faker.date.between to achieve that. the example in faker js demo is just giving a null value.
Hamza
  • 81
  • 1
  • 1
  • 7
5
votes
1 answer

How to concatenate Faker's random first name and its last name to a full name in Laravel 5

I am trying to use Faker in Laravel 5. Now I need to create some users in my User table, I choose Faker. I know how to create random firstname, lastname or userName, but I want to concatenate each FN and LN to be username, how can I do that? Here is…
bill dou
  • 93
  • 1
  • 2
  • 7
4
votes
1 answer

Using Faker with Cypress

I'm starting with Cypress and I want to add Faker to generate random values. But I'm getting following results. Could you please help me to troubleshooting that? login_page.js const faker = require('faker'); before(() => { let userData = { …
4
votes
3 answers

How to use fakerjs in Cypress

I am trying to use fakerjs in my cypress tests to randomly generate fake data for my forms. I have tried exporting it in support/index.js which did not work. Is there any standard way to add fakerjs to all cypress specs instead of adding it in every…
user1614862
  • 2,751
  • 6
  • 21
  • 35
4
votes
1 answer

How to generate random string using Laravel Faker between min and max number of characters

I'm looking for a way to generate random string between min and max number of characters using laravel Faker. I have to create random strings between 4 and 20 characters. This method str_random will generate exactly 20 characters, but how to specify…
ivva
  • 2,539
  • 6
  • 25
  • 57
4
votes
1 answer

FactoryBot and Faker - unique is not working

I'm using FactoryBot and Faker for my tests, and it looks like that Faker is generating the same name: class Profile < ApplicationRecord belongs_to :user validates_presence_of :first_name, :last_name, :nickname validates :nickname, uniqueness:…
sekmo
  • 1,090
  • 13
  • 22
4
votes
1 answer

Pre-populate an object with fake data

Is there a way to pre-populate an object with fake data with Faker without specifying property rules explicitly. I found it is taking way too much time specifying rules for each property in order to populate an object with random data. How about a…
lucas
  • 3,457
  • 6
  • 23
  • 42
4
votes
2 answers

How to generate a unique fake email with a custom domain with faker?

I have a laravel application that requires the registered users must use their company email (custom domain). So how i can i achieve that with faker generators to test it with my model factories ?
Ramy Tamer
  • 510
  • 8
  • 16
4
votes
1 answer

Error when trying to import data with Marak/faker.js

I can't seem to find my problem. Anyone see what I am doing wrong? This project is made with Meteor and React. My import file: import _ from 'lodash'; import { lorem, faker } from 'faker'; import { Comments } from…
Deelux
  • 807
  • 2
  • 9
  • 24
1 2
3
37 38