Creating testdata with ChatGPT

Creating test data is a common challenge for testers, often requiring a blend of creativity and realism. Fortunately, artificial intelligence offers a streamlined solution for this task. For instance, let’s say we need to generate data for 5 users, each with specific attributes like first name, last name, date of birth (ensuring they are all adults), language, nationality, and email. Here’s how AI can effortlessly fulfill this request:

  1. Jennifer Taylor
    • Date of Birth: May 15, 1969
    • Language: Bambara
    • Nationality: Lao People’s Democratic Republic
    • Email: efranklin@gmail.com
  2. Lisa Moore
    • Date of Birth: October 15, 1992
    • Language: Portuguese
    • Nationality: Congo
    • Email: bmack@yahoo.com
  3. Denise Cantrell
    • Date of Birth: September 30, 2004
    • Language: North Ndebele
    • Nationality: Nigeria
    • Email: owhite@lewis-perry.com
  4. Jonathan Martin
    • Date of Birth: June 29, 1975
    • Language: Vietnamese
    • Nationality: Equatorial Guinea
    • Email: qoneill@gmail.com
  5. Ian Jennings
    • Date of Birth: January 3, 1994
    • Language: Divehi
    • Nationality: Trinidad and Tobago
    • Email: ihouston@gmail.com

If you’re working with a database, AI can also assist in creating an SQL script for seamless integration. For example:

Give the prompt:

Can you create 5 test data users in an insert sql script for the table users with the columns firstname,lastname,nationality,dateofbirth,email

Which give you:

INSERT INTO users (firstname, lastname, nationality, dateofbirth, email) VALUES ('Jennifer', 'Taylor', 'Lao People''s Democratic Republic', '1969-05-15', 'efranklin@gmail.com'), ('Lisa', 'Moore', 'Congo', '1992-10-15', 'bmack@yahoo.com'), ('Denise', 'Cantrell', 'Nigeria', '2004-09-30', 'owhite@lewis-perry.com'), ('Jonathan', 'Martin', 'Equatorial Guinea', '1975-06-29', 'qoneill@gmail.com'), ('Ian', 'Jennings', 'Trinidad and Tobago', '1994-01-03', 'ihouston@gmail.com'); 

This approach not only saves time but also ensures a diverse range of realistic test data, enhancing the testing process’s efficiency and effectiveness.

Leave a Reply

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