Dynamic Test Automation Data Using a Faker

Have you ever had to automate an application that required unique data for every test run?
It can be a pain.
I use to have to automate a hospital application that required that I register a new patient in every test before the rest of the workflow could proceed.
The only issue was that each username and social security number had to be unique.
Hardcoded data would not work in this scenario and seeding the database with users beforehand than cleaning up after was messy and time-consuming.
What to do? Faker to the rescue.

What is a Data Faker?
A faker allows you to dynamically create real looking data like names, phone numbers, addresses, SSN — all kinds of stuff.
Lots of times you don’t care about what these values like name or address are so long as you know that your web application will save them correctly.
Using a faker allows you to model this data and create fresh dynamic values for these fields ever test run.
This approach has been recommended a few times on my test automation podcast TestTalks. For example, check out my interview with Paul Merrill on Data Strategies in Testing
Also, Titus Fortner showed an example in his Automation Guild 2018 session on using a Faker in his Crafting a Test Framework session.
Selenium Data Faker Example
Say for example I’m testing an application as if I was a user in Italy. Using faker and passing it a locale of it_IT(Italian) it will generate Italian names and address. Here is an example using Selenium with Python with a Faker
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from faker import Faker
fake = Faker('it_IT')
full_name = (fake.name())
print(full_name)
print(fake.address())
first,last = full_name.split()
driver = webdriver.Chrome('C://Download/chromedriver.exe')
driver.get("https://testguild.com/SeleniumTestPage.html")
assert "WebDriver" in driver.title
first_name = driver.find_element_by_name("fname")
last_name = driver.find_element_by_name("lname")
first_name.clear()
first_name.send_keys(first)
last_name.send_keys(last)
first_name.send_keys(Keys.RETURN)
driver.close()
This simple code generates a dynamic name which I parse into first and last names. I then use those values as inputs in my test applications first and last name fields.
It’s as simple as that.
Of course, you can get as crazy as you want, but as you can see this is powerful even in a simple scenario.

When You Might Want to Use a Faker in Your Test Automation
As we have seen using a faker for values that need to be unique like SSN is a prime user case for utilizing a faker.
- If you are demoing a product to a customer having realistic looking data can help improve the experience. Faker can seed your application with realistic looking data.
- Faster and less maintenance than using hardcoded values
- Since you are using dynamic data, it might uncover an unanticipated bug.
- Test that requires a broad set of test data with a bulk activity.
How to Find a Faker for Your Automation Testing Language
If you’re using an automation tool that allows you to import libraries, you are in luck since there are a bunch of fakers available in most languages. Don’t waste your time creating your custom code to do what an exiting open source library can already do.
There are Faker libraries in many languages, check them out: (Let me know if I missed one of your favorites and I will add it to the list)
- Php: https://github.com/fzaninotto/Faker
- Ruby: https://github.com/stympy/faker
- Python: https://github.com/joke2k/faker or Leo in the comments recommends mimesis https://mimesis.readthedocs.io/ as a better option
- node.js: https://github.com/Marak/faker.js
- F#: https://github.com/fsharp/FAKE
- Java: https://github.com/DiUS/java-faker
- Swift: https://github.com/vadymmarkov/Fakery
- Javascript: https://github.com/boo1ean/casual
- C#: https://github.com/slashdotdash/faker-cs
Don’t over Fake it
Like anything sometimes going overboard can cause more issue than its worth.
Use your judgment when using a Faker and don’t over complicate your test script with unnecessary dynamic values if you don’t have to.
Joe Colantonio is the founder of TestGuild, an industry-leading platform for automation testing and software testing tools. With over 25 years of hands-on experience, he has worked with top enterprise companies, helped develop early test automation tools and frameworks, and runs the largest online automation testing conference, Automation Guild.
Joe is also the author of Automation Awesomeness: 260 Actionable Affirmations To Improve Your QA & Automation Testing Skills and the host of the TestGuild podcast, which he has released weekly since 2014, making it the longest-running podcast dedicated to automation testing. Over the years, he has interviewed top thought leaders in DevOps, AI-driven test automation, and software quality, shaping the conversation in the industry.
With a reach of over 400,000 across his YouTube channel, LinkedIn, email list, and other social channels, Joe’s insights impact thousands of testers and engineers worldwide.
He has worked with some of the top companies in software testing and automation, including Tricentis, Keysight, Applitools, and BrowserStack, as sponsors and partners, helping them connect with the right audience in the automation testing space.
Follow him on LinkedIn or check out more at TestGuild.com.
Related Posts
Bottom Line: Kobiton is the first real device testing platform I’ve seen that makes AI-powered mobile testing feel like it […]
Look, most of the AI testing tools I cover on the TestGuild Automation Podcast share two things in common: they’re […]
At least one in five people has some kind of impairment, so it’s important to have them in mind when […]
Last Updated: April 18, 2026 By Joe Colantonio — 25+ years in testing, 500+ podcast interviews with tool creators Full […]



