Random data generator

random data generator excel
test data generator tool
gs data generator
random contact generator
random name generator api
mysql data generator
json data generator
fill database with dummy data

I have to fill every property of a given object with a random value. These are my requirements for it:

  • All properties are native Java type (int, double, String, etc)
  • I can use reflection
  • I can use Spring DirectFieldAccessor

I don't want to re-invent the square wheel so I prefer to ask. For now I came up with this:

Get all properties name with:

Field field : myObject.getClass().getDeclaredFields()

Iterate over those fields and get their class.

Use a giant switch statement for each known native Java type and generate a random value.

What do you think?


Another option is QuickTheories. It looks like:

import static org.quicktheories.QuickTheory.qt;
import static org.quicktheories.generators.SourceDSL.*;

public class SomeTests {

  @Test
  public void addingTwoPositiveIntegersAlwaysGivesAPositiveInteger(){
    qt()
      .forAll(integers().allPositive()
          , integers().allPositive())
      .check((i,j) -> i + j > 0); 
  }

  @Test
  public void someTheoryOrOther(){
    qt()
      .forAll(integers().allPositive()
          , strings().basicLatinAlphabet().ofLengthBetween(0, 10)
          , lists().allListsOf(integers().all()).ofSize(42))
      .assuming((i,s,l) -> s.contains(i.toString())) // <-- an assumption
      .check((i,s,l) -> l.contains(i) && s.contains(i.toString()));
  }
}

Generate Data, Free random data generator for excel. Generate random data online and export to XLS, CSV. With this in mind, the new version of the script (3.0.0+) was designed to be fully extensible: developers can write their own Data Types to generate new types of random data, and even customize the Export Types - i.e. the format in which the data is output.


As this is one randomizer for random data generation.This uses concept of Reflection only as you mentioned. It checks annotation mentioned upon field and based on that it checks for Provider class.Go through Person model class. It has some primitive and non-primitive fo field in that.

public class Person {

   @FirstName
   public String mFirstName;

   @LastName
   public String mLastName;

   @Number(min = 14,max = 25,decimals = 0)
   public int age;

   @Email
   public String mEmailId;

   @ReferenceRecord(clazz = Address.class)
   public Address address;

}

@ReferencedRecord
public class Address {

   @StreetAddress
   public String streetAddress;

   @State
   public String state;
}

//Generate random 100 Person(Model Class) object 
Generator<Person> generator = new Generator<>(Person.class);  
List<Person> persons = generator.generate(100);                          

As there are many built in data generator is accessible using annotation,You also can build custom data generator using @CustomGenerator annotation.I suggest you to go through documentation provided on library page.

Random Data Generator, Types of Test Data Generator. The 4 types of test data generation tools include: Random; Pathwise; Goal; Intelligent. A free test data generator and API mocking tool - Mockaroo lets you create custom CSV, JSON, SQL, and Excel datasets to test and demo your software.


You can use a library called MockNeat to programatically "fill" your objects with arbitrary data that can pass as "real".

For example in oder to populate an object you can take a look of the reflect() method:

// Creates a MockNeat object that internally uses
// a ThreadLocalRandom.
MockNeat m = MockNeat.threadLocal();

List<Employee> companyEmployees =
                m.reflect(Employee.class) // The class we are mocking
                 .field("uniqueId",
                        m.uuids()) // Generates a random unique identifier
                 .field("id",
                        m.longSeq()) // Generates long numbers in a sequence
                 .field("fullName",
                        m.names().full()) // Generates a full name for the employer
                 .field("companyEmail",
                        m.emails().domain("company.com")) // Generates a company email with a given domain
                 .field("personalEmail",
                        m.emails()) // Generates an arbitrary email without domain constraints
                 .field("salaryCreditCard",
                        m.creditCards().types(AMERICAN_EXPRESS, MASTERCARD)) // Generate credit card numbers of 'types'
                 .field("external",
                        m.bools().probability(20.0)) // Generates Boolean values with 20% probability of obtaining True
                 .field("hireDate",
                        m.localDates().past(of(1999, 1, 1))) // Generatest a date in the past, but greater than 01.01.1987
                 .field("birthDate",
                        m.localDates().between(of(1950, 1, 1), of(1994, 1, 1))) // Generates a data in the given range
                 .field("pcs",
                        m.reflect(EmployeePC.class) // Mock an EmployeePC object
                         .field("uuid",
                                m.uuids()) // Generates an unique identifier
                         .field("username",
                                m.users()) // Generates an arbitrary username
                         .field("operatingSystem",
                                m.from(new String[]{"Linux", "Windows 10", "Windows 8"})) // Randomly selects an OS from the given List
                         .field("ipAddress",
                                m.ipv4s().type(CLASS_B)) // Generates a CLASS B IPv4 Address
                         .field("macAddress",
                                m.macs()) // Generates a MAC Address
                         .list(2)) // Creates a List<EmployeePC> with 2 values
                 .list(1000) // Creates a List<Employee> with 1000 values
                 .val(); // Returns the list

Top 10 Best Test Data Generation Tools in 2020, Generate any random data you want with power of agile templates and save it to our servers for later use. Free random data generator - RANDAT.COM allows you to generate online a table with random personal information: name, age, occupation, salary, etc. You can use this data table for education (e.g. teaching, learning MS Excel), for testing databases or for other purposes.


You can try Random-JPA, a framework designed to generate random data. The setup is minimal.

Usage:

CreationPlan creationPlan = jpaContext.create(
        Entity.of(Employee.class, 2).with(Employee_.Country, INDIA),
        Entity.of(Person.class).with(Person_.gender, "Male"));

JSON Generator – Tool for generating random data, The data generator makes getting random fake data to test your application very easy. As such, you can generate realistic test data that includes: fake address or random postal address, books, movies, music, brand, business, colors, country, credit card, date and time, education, gender, identification number, money numbers, person random names, random email address, programming and internet.


Database test data generator, Data Format Support by This Faker Data Generator. Person. Name Title (Random​); Male Name Title (e.g. Mr.) Female Name Title (e.g. Ms.)  Random Data Generator is a tool for Microsoft Excel 2003 and up to create randomly generated fake data for testing, web demos, charting, VBA and much more.


Mock Data Generator Tool, Datanamic Data Generator will help you to generate meaningful test data for it will by default load random data from the parent column in the parent table. The data generator makes getting random fake data to test your application very easy. Generate test data for your database Quick recipes to test real applications with random data


Generate database test data with Datanamic Data Generator, Online test data generator. Generate test data for free and export in CSV Excel SQL and Json. 100.000 records. Random name, string, address, email and guid. In the Generate Random Data dialog box, specify the amount of data to generate, the distribution, and the parameters for the distribution. Generate samples of random data from a distribution - Minitab Express