Friday, February 8, 2019

Create Fake Test Data for Selenium Tests using Java Faker API

Test data is necessary in testing an application, in automation the test data will be either hard-coded or provided from the external sources like Excel, CSV, XML, Database and etc. If its live data that needs to be fetched from sources like Database we have to follow it, there is no other go.

But when we are providing the test data from external files for validating certain functionalities that data needs to be revised after some iterations. It takes lot of manual effort of tester to re-create the test data.

Java Faker API:

In order to reduce the manual effort in creating the test data, we use Java Faker API. Java Faker API is Java library which generates data related to different categories like Company, Internet, Human, Numbers, Food, Finance, Telephone and etc. this covers almost all the type of data that a typical software application would require.

Configure Java Faker API in Selenium Project:

Add Java Faker API maven dependency in the pom.xml (we are using Maven project) as shown below.

Create separate utility class that generates the fake data using Java Faker API library. In the below class we created methods that generate first name, last name, password, email and etc.

In the below Selenium test, we are automating facebook account create form. In this test we need to enter first name, last name, email Id and password.

We created an object to JavaFakerAPI utility class and called the required methods in the selenium tests.

Run this test many times and every time unique values will be generated and we can run this selenium test without changing the test data every time we execute it.

This is how we can reduce the manual effort in creating the new test data every time.

#HappyLearning #HappyTesting


  1. Valuable info.Thanks for sharing.Want to know same package will use selenium C#

  2. Hi Venkat, I don't think its possible to use same for Selenium C#. If I found, will let you know.

  3. After reading this web site I am very satisfied simply because this site is providing comprehensive knowledge for you to audience.
    Thank you to the perform as well as discuss anything incredibly important in my opinion. We loose time waiting for your next article writing in addition to I beg one to get back to pay a visit to our website in

    Selenium training in Chennai
    Selenium training in Bangalore
    Selenium training in Pune

  4. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    Selenium Training in Electronic City

  5. You make so many great points here that I read your article a couple of times. Your views are in accordance with my own for the most part. This is great content for your readers. where can i buy a fake id

  6. Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. fake id online

  7. I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post. best fake id

  8. I have to search sites with relevant information on given topic and provide them to teacher our opinion and the article. Scannable Fake Id

  9. This is a great blog that explains how we can Create Fake Test Data for Selenium Tests. You can buy high quality Fake ID for Sale at great prices.

  10. The frenzy doesn't stop with the IT division. For other organization directors, IT changes implies hours or long stretches of preparing, vacation and loss of profitability that accompanies IT issues, disappointments, or framework redesigns. ExcelR Data Science Courses

  11. Really useful information. Thank you so much for sharing. It will help everyone. Keep Post.

    Best Microsoft Training in Bangalore for Microsoft, we provide the Microsoft training project with trainers having more than 5 Years of Microsoft training experience, we also provide 100% placement support.

  12. Hi there, I read your blogs on a regular basis. Your humoristic style is witty, keep it up! Thank You for Providing Such a Unique and valuable information, If you are looking for the best Google Search Api, then visit SERP House.I enjoyed this post.

  13. Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic.

    Selenium Training in Electronic City

  14. Thanks you for sharing this unique useful information content with us. Really awesome work. keep on blogging.
    Microsoft Azure Training in Electronic City

  15. Excellent Blog! I would like to thank for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. I wanted to thank you for this websites! Thanks for sharing. Great websites!

    machine learning course

    artificial intelligence course in mumbai


Selenium4: Working with two parallel windows in Selenium Automation

A new method newWindow() is introduced in Selenium 4 (Alpha). Using this method we can open a new tab or new window from the current window...