Send Raw Record : When record from file is sent
Produces a raw (String-serialised) message to a Kafka input topic. The file content is read as-is, with dynamic variables resolved before sending.
Syntaxโ
When record from file is sent
| topicName | file | recordKey | headerFile |
| orders-in | order.json | order-001 | headers.json |
| Column | Type | Required | Description |
|---|---|---|---|
topicName | string | โ | Name or alias of a declared input topic |
file | string | โ | Path to the payload file, relative to the assets directory |
recordKey | string | โ | Kafka record key; omit to send with null key |
headerFile | string | โ | Path to a JSON file containing Kafka headers ({"headerName": "headerValue"}) |
File formatโ
The file can contain any text content, JSON, XML, plain text, CSV. KTestify sends it verbatim as the record value (String serialisation). Dynamic variables (e.g. {{DATE:yyyy-MM-dd}}) are resolved before sending.
assets/order.json
{
"orderId": "{{RANDOM:UUID}}",
"createdAt": "{{DATE:yyyy-MM-dd}}",
"product": "Widget A"
}
Headers file formatโ
assets/headers.json
{
"X-Correlation-Id": "abc-123",
"X-Source-System": "order-service"
}
Multiple records in one stepโ
Add multiple rows to the DataTable to produce several records in sequence, in row order:
When record from file is sent
| topicName | file | recordKey |
| orders-in | order-001.json | order-001 |
| orders-in | order-002.json | order-002 |
Same topic required
Every row must resolve to the same physical topic. Mixing topics in one DataTable throws TopicMismatchException before any record is sent, split into separate step invocations instead. See Multi-row DataTables for the full rules (including single-record assertion steps and batch steps).