Set File

The Set File block in Leapwork allows users to upload or define a file as input from various sources, making it available for downstream blocks in an automation flow. This block is essential when a test flow requires files to be attached, processed, or transferred dynamically across multiple steps.

Example: A test case sends an email with a PDF attachment. The Set File block provides the file input—either uploaded by the user or generated by another block—to the "Send Email" block.

Note: This feature is available starting from Release 2025.1.173

When fully expanded, the following is an example of the Set File block with sample data:

Set_fileSet File block header

The left green input connector in the header is used to trigger the block's execution.

The right green output connector in the header is triggered once the file has been successfully set and is ready for downstream use.

The block title Set File can be renamed by double-clicking on it.

File Input

The Set File block supports multiple file formats, including .txt, .csv, .json, .pdf, .xlsx, and .xml as input. The file content is dynamically provided from other blocks within the automation flow and stored in the Leapwork database (DB).

Source Type

The Set File block offers multiple file sourcing methods through the Source Type dropdown:

  • Data File: Selects an already uploaded file from Leapwork’s Data Files library.
  • Local Path: Allows manual selection and upload of a local file from the user’s system.

Each option is tailored to different use cases, enabling flexibility in test automation.

Text Fields

Add any number of fields that can contain dynamic content.

File

This property represents the output of the block, which is a file.
The blue output connector is triggered once the file has been successfully retrieved, making it available as an input for other building blocks in the flow.

Failed

This connector is triggered if the Set File block fails to upload or retrieve the file due to issues such as missing file input, unsupported file formats, or internal system errors.

 

Created  31.3.25