liveBook · Manning

Format tactic

As explained in Software Testing with Generative AI

A prompting technique that specifies the required representation or serialization format of a model's output.

The format tactic specifies the representation a model must return, such as a JSON array or XML document. In test-data generation, stating the required structure makes outputs easier to consume and evaluate, while explicit field rules improve conformity. section 6.1.1

Requesting structured room data

A prompt can request five JSON objects in an array, define fields such as room_name, beds, accessible, and roomPrice, and constrain each field's type or options. Rewording the format requirement can request the same dataset as XML. Explicit requirements produce mostly expected values, but image URLs may be placeholders and relationships such as room type versus bed count still require human checking. section 6.1.1

% 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 delimited field specification that supplies the format tactic with names, data types, and allowed or randomized values. section 6.1.1

How Software Testing with Generative AI covers it

How deep it goes
Demonstrates format selection through prompts, then stops short of guaranteeing valid values or cross-field consistency.
Examples
Uses room records, delimited field definitions, JSON arrays, and XML room documents.
What you can do after
Apply it to request structured test data in a chosen serialization format, then verify values and relationships.
How it connects
Connects format tactic with delimiter tactic, prompt engineering, test data generation, and hallucination risk.

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.