liveBook · Manning

Test data

As explained in Software Testing with Generative AI

Test data is the input and supporting information provided to software under test to exercise specified behaviors and conditions.

Test data is the input and supporting information used to trigger software behavior and observe results. Realistic, useful, anonymized data can determine whether testing succeeds, but creating and managing it consumes substantial time and resources. section 1.1.1 section 6.0

LLMs can rapidly generate, transform, and expand test data, provided that prompts state the required structure, values, relationships, format, and validation rules explicitly. Their output remains probabilistic and requires human checking. section 6.1 section 6.4

Useful practices include:

  • Define fields with delimiters, data types, allowed values, ranges, and randomization rules. section 6.1.1
  • Specify the output format and ask the generator to check record counts, types, syntax, and relationships before returning data. section 6.1.1 section 8.2.2
  • Inspect generated values against the system’s actual validation rules; plausible values may still be invalid or semantically inconsistent. section 6.1.1 section 7.2.1
  • Protect personal and organizational privacy when supplying examples or existing data to an LLM. section 6.4

Generating structured room data

A prompt can request five JSON objects and define room_name, type, beds, accessibility, image, description, features, and roomPrice with explicit types and permitted values. The resulting records may look valid, yet example.com image URLs may not identify real images and beds may not match the room type. Tightening the prompt and validating the result against application rules makes the data more useful. section 6.1.1

Seeding large datasets

For exploratory testing requiring thousands of bookings, an LLM can expand an existing INSERT statement into SQL seed data for rooms and bookings. Prompt rules may need adjustment for array fields, while a script can generate 1,000 bookings with randomized rooms, dates, names, and deposit values. section 8.2.2

% room_name | string | random
% type | string |  'single' or 'double'
% beds | integer | 1 to 6
% accessible | boolean | true or false
% image | string | random url
% description | string | random max 20 characters
% features | array[string] | 'Wifi', 'TV' or 'Safe'
% roomPrice |  integer | 100 to 200

Shows a compact delimited specification for generating room records, including field types, ranges, allowed values, and randomization instructions. section 6.1.1

How Software Testing with Generative AI covers it

How deep it goes
Explains prompt-driven generation, transformation, seeding, and validation, but stops short of fully automating human judgment and verification.
Examples
Uses JSON room records, delimited field specifications, SQL seed files, large booking sets, and HTTP message payloads.
What it assumes
Assumes knowledge of the system’s data requirements and validation rules while teaching structured prompting and data creation incrementally.
What you can do after
Build it from scratch, transform it, and integrate it into automated checks using prompts, SQL seed files, scripts, or APIs.
How it connects
Connects test data with LLMs, prompt engineering, exploratory testing, automated testing, performance testing, SQL, and privacy.

Also explained in

Compare how 3 books explain test data →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Testing with Generative AI. The section links point to the parts of the book it draws on.