Adding More Fake Data

In the last entry we added our new People By Location page and when we looked at in the the browser is was fairly empty apart from the one test user.

Not very easy to do any proper testing with just one entry. You COULD if you wanted add a bunch more test users manually but what if you wanted to test with a few thousand users, that would be a lot of copy/pasting.

Thankfully there is an easier way using a Data Faker.

First I need to add a new dependency to my pom file for the JavaFaker project on GitHub

Now in my DemoData class I just need to instantiate the Faker object and then I can call the different accessors to pull out different pieces of random data.

As I have three locations setup in my demo data I have also decided to randomly select one of the locations to put my fake data in to. I then encapsulate it in a loop and I can easily generate as much demo data as I need to properly test the application.




Tagged with:
Posted in Domino To Spring
%d bloggers like this: