Generating testing data with Claude
Today I’m going to show you how we can create test data with Claude.
For this exercise, we’re going to use the website Automation Exercise, which already has a suite of tests designed for you to run/automate.
Test Preparation
In the section test cases, there are user interface tests, as well as API tests, and among these test cases, we’ll choose the first: registering a new user.
And then, in steps 9 and 12, we can see what information we need to run the test. The needed fields are title, name, email, password, date of birth, company, address, country, state, city, zip code, and phone number.
Putting Together the Prompt for Claude
So, here we are going to define what we are going to ask Claude:
¿Can you create 20 data records to run tests that require first name, last name, email address, password, date of birth, company, address, country, state/province, postal code, and phone number?
And, super important! To improve the results, we’ll tell Claude what data format we want and how to read it. So, I specify that each of these parameters is described with a dollar sign and the data type with a pipe. Like this:
$ name | string | random
We expand the prompt with the details of the data types; we can be as specific as our test requires:
For the email I also want it to be random data, but of the email type and not just a string.
Para el correo electrónico también quiero que sea data random, pero de tipo email y no solamente string.
For the password, I want it to be like password, and that way we make sure that the password is a password like the one we would actually use in real life.
More data variations
I want the date of birth to be a date type, which is a date, and I’m going to give it a range: from January 1st, 2020, to December 31st, 2024.
For the company I also want it to be a string type and I want it to be random, but with a maximum of 15 characters.
ParaFor the address, let it be random in Cuenca, Azuay, Ecuador.
For the country, let it be a fixed value: Ecuador.
And for the state as well, let it be a fixed value.
The postal code, which must be random and exactly six characters long.
And for the phone number I also want it to be an Ecuadorian number and I’m going to tell it that I want it to start with +593 and add nine numeric characters.
Prompt
Our final prompt is:
Can you create 20 data records to run tests that require: first name, last name, email, password, date of birth, company, address, country, state/province, postal code, and phone number?.
Each of these parameters is described with the $ sign and the data type with the | sign.
$ first_name | string | random
$ last_name | string | random
$ email | email | random
$ password | password | random
$ date_of_birth | date | 01/01/2000 to 12/31/2024
$ company | string | random max 15 characters
$ address | string | random in Cuenca, Azuay, Ecuador
$ country | string | "Ecuador"
$ state | string | "Azuay"
$ postal_code | number | random of 6 characters
$ phone | string | starting with "+593" plus 9 numeric chars
Results
And let’s see the data that Claude provides.
First Name | Last Name | Password | Date of Bithday | Company | Address | Country | State | Postal Code | Phone | |
---|---|---|---|---|---|---|---|---|---|---|
Martín | Coronel | martin.coronel@ejemplo.com | K7p$L2xR!9aZ | 15/03/2010 | TechSoluciones | Av. Remigio Crespo 243, Cuenca | Ecuador | Azuay | 010183 | +593987654321 |
Lucía | Mendoza | lucia.mendoza@correo.net | Bj3*wF8zQ!5p | 24/07/2005 | MegaStore | Calle Larga 122, Cuenca | Ecuador | Azuay | 010154 | +593912345678 |
Carlos | Valencia | carlos.valencia@mail.org | P9q@T4mE$7vX | 03/11/2018 | DataFusion | Gran Colombia 756, Cuenca | Ecuador | Azuay | 010167 | +593998765432 |
Andrea | Jaramillo | andrea.jaramillo@inbox.ec | Z5s&C2dG!8hL | 19/02/2002 | EcoSistemas | Federico Proaño 891, Cuenca | Ecuador | Azuay | 010112 | +593945678901 |
Javier | Salazar | javier.salazar@webmail.com | M3b#R9tY$4kP | 30/09/2015 | InnovaTech | Av. Solano 456, Cuenca | Ecuador | Azuay | 010132 | +593923456789 |
Daniela | Paredes | daniela.paredes@correoec.com | X6f%N2qZ!7gJ | 12/04/2009 | GlobalNet | Primero de Mayo 345, Cuenca | Ecuador | Azuay | 010198 | +593976543210 |
Gabriel | Torres | gabriel.torres@mensajero.net | D8h*W5vB$2mK | 27/08/2020 | RedConecta | Av. de las Américas 789, Cuenca | Ecuador | Azuay | 010145 | +593934567890 |
Valeria | Moreno | valeria.moreno@buzon.org | L4j@S7pF!9cQ | 05/06/2003 | VisualDesign | Mariscal Lamar 567, Cuenca | Ecuador | Azuay | 010176 | +593965432109 |
Roberto | Espinoza | roberto.espinoza@mail.net | F2k%H8xD$6rS | 22/12/2016 | CreaSoft | Paseo 3 de Noviembre 234, Cuenca | Ecuador | Azuay | 010188 | +593954321098 |
Camila | Romero | camila.romero@webbox.com | T9n&G3cV!5bM | 08/01/2007 | DigiCorp | Simón Bolívar 678, Cuenca | Ecuador | Azuay | 010121 | +593943210987 |
Esteban | Guerrero | esteban.guerrero@correobox.ec | H6p#L1zR$7wQ | 17/10/2014 | SystemPlus | Alfonso Cordero 123, Cuenca | Ecuador | Azuay | 010156 | +593921098765 |
Sofía | Palacios | sofia.palacios@mailec.com | V3m%S9bT!4fC | 28/05/2001 | NetSolutions | Juan Jaramillo 345, Cuenca | Ecuador | Azuay | 010178 | +593932109876 |
Alejandro | Velasco | alejandro.velasco@correopro.net | Q7r*K5nH$2jP | 09/03/2019 | MediaGroup | Luis Cordero 567, Cuenca | Ecuador | Azuay | 010134 | +593989012345 |
Isabella | Andrade | isabella.andrade@webnet.org | Y1t@B8gM!6pV | 14/06/2006 | LogiSmart | Mariscal Sucre 789, Cuenca | Ecuador | Azuay | 010190 | +593978901234 |
Sebastián | Cevallos | sebastian.cevallos@inboxpro.com | N4w%F7hJ$9sZ | 26/11/2013 | ProConsult | Presidente Córdova 234, Cuenca | Ecuador | Azuay | 010143 | +593967890123 |
Carolina | Delgado | carolina.delgado@mail.com | E8u&R2dT!3kB | 31/07/2008 | CloudWorks | Antonio Borrero 456, Cuenca | Ecuador | Azuay | 010165 | +593956789012 |
Mateo | Ortiz | mateo.ortiz@buzonec.net | J5x#G9zV$1nM | 11/02/2022 | AppDevelop | Benigno Malo 678, Cuenca | Ecuador | Azuay | 010187 | +593945678901 |
Paula | Rivadeneira | paula.rivadeneira@webmail.ec | C2y%W6qS!8rP | 18/04/2004 | SmartData | Hermano Miguel 345, Cuenca | Ecuador | Azuay | 010123 | +593934567890 |
Diego | Maldonado | diego.maldonado@correo.com | U7v*N3bF$4tD | 07/09/2017 | TecnoGlobal | Tarqui 567, Cuenca | Ecuador | Azuay | 010176 | +593923456789 |
Valentina | Hidalgo | valentina.hidalgo@inboxmail.org | A1z@R6kG!9wH | 23/08/2011 | InfoSystems | Sucre 789, Cuenca | Ecuador | Azuay | 010154 | +593912345678 |
I was quite surprised by the data we obtained:
- They all seem to be real names, although they are test data.
- The emails have the exact same first and last name that you generated and you add some test domains to it (como mail.com, inbox.ec).
- The passwords!!!! we can see real passwords that meet minimum standards.
- The birth dates are all within the range we especified.
- The companies, definitely look like real company names.
- The address was what struck me the most: they are real addresses in Cuenca, Azuay, Ecuador, the city where I live.
- The postal codes, although I requested them, all correspond to Cuenca (the city I specified as an address).
- The phone numbers are not real but the format is.
The data is incredibly powerful, allowing us to test tons of cases with relevant information—information that a real user will actually provide to our app.
Formats of data
Initially the data was in a table, but for automation purposes, the data in JSON format is more useful to us, so we are going to ask Claude for it with a super simple prompt as well (as a response to the same conversation):
Can you give me this data in JSON format?
And here we see the result, the same data in JSON format:
[
{
"first_name": "Martín",
"last_name": "Coronel",
"email": "martin.coronel@ejemplo.com",
"password": "K7p$L2xR!9aZ",
"date_of_birth": "15/03/2010",
"company": "TechSoluciones",
"address": "Av. Remigio Crespo 243, Cuenca",
"country": "Ecuador",
"state": "Azuay",
"postal_code": "010183",
"phone": "+593987654321"
},
{
"first_name": "Lucía",
"last_name": "Mendoza",
"email": "lucia.mendoza@correo.net",
"password": "Bj3*wF8zQ!5p",
"date_of_birth": "24/07/2005",
"company": "MegaStore",
"address": "Calle Larga 122, Cuenca",
"country": "Ecuador",
"state": "Azuay",
"postal_code": "010154",
"phone": "+593912345678"
},
{
"first_name": "Carlos",
"last_name": "Valencia",
"email": "carlos.valencia@mail.org",
"password": "P9q@T4mE$7vX",
"date_of_birth": "03/11/2018",
"company": "DataFusion",
"address": "Gran Colombia 756, Cuenca",
"country": "Ecuador",
"state": "Azuay",
"postal_code": "010167",
"phone": "+593998765432"
},
{
"first_name": "Andrea",
"last_name": "Jaramillo",
"email": "andrea.jaramillo@inbox.ec",
"password": "Z5s&C2dG!8hL",
"date_of_birth": "19/02/2002",
"company": "EcoSistemas",
"address": "Federico Proaño 891, Cuenca",
"country": "Ecuador",
"state": "Azuay",
"postal_code": "010112",
"phone": "+593945678901"
},
{
"first_name": "Javier",
"last_name": "Salazar",
"email": "javier.salazar@webmail.com",
"password": "M3b#R9tY$4kP",
"date_of_birth": "30/09/2015",
"company": "InnovaTech",
"address": "Av. Solano 456, Cuenca",
"country": "Ecuador",
"state": "Azuay",
"postal_code": "010132",
"phone": "+593923456789"
},
{
"first_name": "Daniela",
"last_name": "Paredes",
"email": "daniela.paredes@correoec.com",
"password": "X6f%N2qZ!7gJ",
"date_of_birth": "12/04/2009",
"company": "GlobalNet",
"address": "Primero de Mayo 345, Cuenca",
"country": "Ecuador",
"state": "Azuay",
"postal_code": "010198",
"phone": "+593976543210"
},
{
"first_name": "Gabriel",
"last_name": "Torres",
"email": "gabriel.torres@mensajero.net",
"password": "D8h*W5vB$2mK",
"date_of_birth": "27/08/2020",
"company": "RedConecta",
"address": "Av. de las Américas 789, Cuenca",
"country": "Ecuador",
"state": "Azuay",
"postal_code": "010145",
"phone": "+593934567890"
},
{
"first_name": "Valeria",
"last_name": "Moreno",
"email": "valeria.moreno@buzon.org",
"password": "L4j@S7pF!9cQ",
"date_of_birth": "05/06/2003",
"company": "VisualDesign",
"address": "Mariscal Lamar 567, Cuenca",
"country": "Ecuador",
"state": "Azuay",
"postal_code": "010176",
"phone": "+593965432109"
},
{
"first_name": "Roberto",
"last_name": "Espinoza",
"email": "roberto.espinoza@mail.net",
"password": "F2k%H8xD$6rS",
"date_of_birth": "22/12/2016",
"company": "CreaSoft",
"address": "Paseo 3 de Noviembre 234, Cuenca",
"country": "Ecuador",
"state": "Azuay",
"postal_code": "010188",
"phone": "+593954321098"
},
{
"first_name": "Camila",
"last_name": "Romero",
"email": "camila.romero@webbox.com",
"password": "T9n&G3cV!5bM",
"date_of_birth": "08/01/2007",
"company": "DigiCorp",
"address": "Simón Bolívar 678, Cuenca",
"country": "Ecuador",
"state": "Azuay",
"postal_code": "010121",
"phone": "+593943210987"
},
{
"first_name": "Esteban",
"last_name": "Guerrero",
"email": "esteban.guerrero@correobox.ec",
"password": "H6p#L1zR$7wQ",
"date_of_birth": "17/10/2014",
"company": "SystemPlus",
"address": "Alfonso Cordero 123, Cuenca",
"country": "Ecuador",
"state": "Azuay",
"postal_code": "010156",
"phone": "+593921098765"
},
{
"first_name": "Sofía",
"last_name": "Palacios",
"email": "sofia.palacios@mailec.com",
"password": "V3m%S9bT!4fC",
"date_of_birth": "28/05/2001",
"company": "NetSolutions",
"address": "Juan Jaramillo 345, Cuenca",
"country": "Ecuador",
"state": "Azuay",
"postal_code": "010178",
"phone": "+593932109876"
},
{
"first_name": "Alejandro",
"last_name": "Velasco",
"email": "alejandro.velasco@correopro.net",
"password": "Q7r*K5nH$2jP",
"date_of_birth": "09/03/2019",
"company": "MediaGroup",
"address": "Luis Cordero 567, Cuenca",
"country": "Ecuador",
"state": "Azuay",
"postal_code": "010134",
"phone": "+593989012345"
},
{
"first_name": "Isabella",
"last_name": "Andrade",
"email": "isabella.andrade@webnet.org",
"password": "Y1t@B8gM!6pV",
"date_of_birth": "14/06/2006",
"company": "LogiSmart",
"address": "Mariscal Sucre 789, Cuenca",
"country": "Ecuador",
"state": "Azuay",
"postal_code": "010190",
"phone": "+593978901234"
},
{
"first_name": "Sebastián",
"last_name": "Cevallos",
"email": "sebastian.cevallos@inboxpro.com",
"password": "N4w%F7hJ$9sZ",
"date_of_birth": "26/11/2013",
"company": "ProConsult",
"address": "Presidente Córdova 234, Cuenca",
"country": "Ecuador",
"state": "Azuay",
"postal_code": "010143",
"phone": "+593967890123"
},
{
"first_name": "Carolina",
"last_name": "Delgado",
"email": "carolina.delgado@mail.com",
"password": "E8u&R2dT!3kB",
"date_of_birth": "31/07/2008",
"company": "CloudWorks",
"address": "Antonio Borrero 456, Cuenca",
"country": "Ecuador",
"state": "Azuay",
"postal_code": "010165",
"phone": "+593956789012"
},
{
"first_name": "Mateo",
"last_name": "Ortiz",
"email": "mateo.ortiz@buzonec.net",
"password": "J5x#G9zV$1nM",
"date_of_birth": "11/02/2022",
"company": "AppDevelop",
"address": "Benigno Malo 678, Cuenca",
"country": "Ecuador",
"state": "Azuay",
"postal_code": "010187",
"phone": "+593945678901"
},
{
"first_name": "Paula",
"last_name": "Rivadeneira",
"email": "paula.rivadeneira@webmail.ec",
"password": "C2y%W6qS!8rP",
"date_of_birth": "18/04/2004",
"company": "SmartData",
"address": "Hermano Miguel 345, Cuenca",
"country": "Ecuador",
"state": "Azuay",
"postal_code": "010123",
"phone": "+593934567890"
},
{
"first_name": "Diego",
"last_name": "Maldonado",
"email": "diego.maldonado@correo.com",
"password": "U7v*N3bF$4tD",
"date_of_birth": "07/09/2017",
"company": "TecnoGlobal",
"address": "Tarqui 567, Cuenca",
"country": "Ecuador",
"state": "Azuay",
"postal_code": "010176",
"phone": "+593923456789"
},
{
"first_name": "Valentina",
"last_name": "Hidalgo",
"email": "valentina.hidalgo@inboxmail.org",
"password": "A1z@R6kG!9wH",
"date_of_birth": "23/08/2011",
"company": "InfoSystems",
"address": "Sucre 789, Cuenca",
"country": "Ecuador",
"state": "Azuay",
"postal_code": "010154",
"phone": "+593912345678"
}
]
Conclussions
- Using tools like Claude allows you to generate large (or not so large) volumes of test data quickly and efficiently, facilitating the execution of test cases.
- We can specify formats, ranges, and data types for each required field (name, email, password, address, etc.), ensuring that the generated data is realistic and relevant to our testing scenarios.
- Relying on AI to create test data saves us time and allows us to focus on designing scenarios, use cases, environments, and other assets.
- The generated data can be exported in different formats (such as spreadsheets or JSON), facilitating its integration with automation tools and testing frameworks.
- ¡Including these types of solutions in the development cycle can make a difference in the efficiency and effectiveness of any team!