Select Page
Automation Testing

Test Data Generation Using Faker

Being a leading QA Company, we write blogs on all prominent software testing topics and tools using our real-world experience. So stay sharp by subscribing to our Newsletter.

Listen to this blog

Feeding test data in automated test suite is an additional effort. However, having all the dummy test data in Excel Sheet, XML, and JSON increases maintenance effort a little bit. For example: Consider you have mentioned a phone number in Excel sheet instead of creating random phone number on fly. If you take copy of the test data sheet to execute on different environment, then you are duplicating the static phone number and it will increase the test data maintenance effort. Our suggestion is Never have your random/dummy data in test data file.

In this blog article, you will learn how to use test data generation in Python using Faker package. Nowadays, Selenium automation testing using Python is gaining more popularity. Python packages which are useful for test automation ease script development.


pip install Faker

Basic Usage

from faker import Faker
fake = Faker()
# 'Lucy Cechtelar'

# '426 Jordy Lodge
#  Cartwrightshire, SC 88120-6700'

# 'Sint velit eveniet. Rerum atque repellat voluptatem quia rerum. Numquam excepturi
#  beatae sint laudantium consequatur. Magni occaecati itaque sint et sit tempore. Nesciunt
#  amet quidem. Iusto deleniti cum autem ad quia aperiam.
#  A consectetur quos aliquam. In iste aliquid et aut similique suscipit. Consequatur qui
#  quaerat iste minus hic expedita. Consequuntur error magni et laboriosam. Aut aspernatur
#  voluptatem sit aliquam. Dolores voluptatum est.
#  Aut molestias et maxime. Fugit autem facilis quos vero. Eius quibusdam possimus est.
#  Ea quaerat et quisquam. Deleniti sunt quam. Adipisci consequatur id in occaecati.
#  Et sint et. Ut ducimus quod nemo ab voluptatum.'


Submit a Comment

Your email address will not be published. Required fields are marked *

Talk to our Experts

Amazing clients who
trust us