![]() ![]() ("Cell number is: "+faker.phoneNumber(). ("Country name is: "+faker.address().country()) ("State name is: "+faker.address().state()) ("City name is: "+faker.address().cityName()) ("Last name is: "+faker.name().lastName()) ("First name is: "+faker.name().firstName()) Create an object of Faker class with default locale i.e ENGįaker faker = new Faker(new Locale("en-IND")) ![]() For this post I have used the below version of this dependency:. To use Javafaker library in your Java project we need to use the latest dependency of this library from the Maven central repo. ![]() If you want to get a random city name of US you can select US locale or if you want an Indian city use IND locale. You can generate fake real data for name, address, city, state as per locale. Javafaker API is a Java library that provides utilities to generate pretty data for the showcase randomly. Yes, It is possible using Java Faker API. Will be not it good if we could generate fake data that looks like real data? Something a real name like “Amod” or “John”. But these data were meaningless although it serves the purpose. Python Faker package generates fake data which can used. We used to generate some random data for these fields so that there is no need to pass data explicitly. Faker module in Python is very helpful module to create varied test data in any amount that we need. Generating some random data helps you to eliminate boilerplate codes or unnecessary headaches of maintaining data.įor example:- If you need to register a user which requires first name, last name, age, address, etc. I remember when I used to generate some random data with alphabets and numbers which were meaningless words like “Bjhet”, “Hyiue” etc. ![]()
0 Comments
Leave a Reply. |