Document Generation Steps

How to generate TXT and CSV files during test execution — for testing file upload workflows, data exports, and document-dependent features.

circle-info

Who is this for? Testers and SDETs who need to generate test files (TXT or CSV) dynamically during test execution for use in file upload, import, or data processing workflows.

Document generation steps create files during test runtime with configurable content. Use them when your test needs to upload a file with specific data, verify an import workflow with known values, or test document processing features with controlled inputs.

Prerequisites

  • You have created or opened a test case.

  • You are familiar with the Test Steps Editor basics.


Adding a document generation step

  1. Open a test case and click Add Step.

  2. In the step builder sidebar, select Document.

  3. Configure the document type, file name, and data mappings.

  4. Click Create Step to add the step to your test case.


Fields

Field
Required
Description

Document Type

Yes

The file format to generate: txt or csv.

Output Variable

Yes

The variable name that stores the generated file reference. Default: Input.

File Name

Yes

The name of the generated file (e.g., test-data.csv).

TXT-specific fields

Field
Description

Separator

The string used to separate values within the file.

File Format Header

Header content written at the top of the file.

CSV-specific fields

Field
Description

Delimiter

The character used to separate columns: Comma (,), Semicolon (;), Tab, or Pipe (|).

Template source

You can populate the document from a template or define content from scratch:

Option
Description

Create New

Define a new template with a name and description. The template is saved for reuse.

Existing

Select a previously saved template by ID.

Upload

Upload a template file to use as the base.

Data mappings

Each mapping row defines a column or field in the generated file:

Field
Description

Key

The column or field name.

Value Type

How the value is sourced: Variable, Static, Expression, Reference, or Text (legacy alias for Static).

Value

The actual value or variable reference (e.g., ${testEmail} for Variable type, or John Doe for Static type).


Example: Generate a CSV for bulk import testing


Example: Generate a TXT configuration file


Advanced settings

Setting
Description

Skip Step

Skip this step during execution without removing it from the test case.

Mark as Optional

If enabled, a failure on this step does not fail the overall test case.


Tips & best practices

  • Use Variable value types to make generated documents dynamic. Reference test data profile columns or environment variables so the file content changes per test run.

  • Save templates for reuse. If multiple test cases need the same file structure with different data, create a template once and select it with the Existing option in subsequent steps.

  • Reference the output variable in later AI Agent steps to upload the generated file. The variable holds the file reference that the upload step uses.

  • Match the file format to what your application expects. If the import feature requires semicolon-delimited CSV, set the delimiter to Semicolon.

Troubleshooting

The uploaded file is rejected by the application Check that the document type, delimiter, and column names match the format your application expects. Generate the file, download it from the execution report artifacts, and inspect its contents.

Variable values are not substituted in the file Verify the variable name syntax (${variableName}) and that the referenced variable is set by an earlier step. Variable names are case-sensitive.

Template not found If using the Existing template option, confirm the template was saved in the same workspace. Templates are scoped to the workspace version.

circle-info

70% less manual test maintenance with AI self-healing. Book a Demo →arrow-up-right — See ContextQA create and maintain tests for your web application.

Last updated

Was this helpful?