This topic explains how to configure and apply the Write File tool, which saves the output of tools.
Understanding Write File
The Write File tool can convert output data to files. The Edit tool is often used in conjunction with this tool because it provides a means to view the files that the Write File tool creates. This tool is primarily used to save the files that result from transformations (XSLT, etc.).It is typically added as an output to an existing tool as described in Adding Test Outputs.
Customizing Write File
You can customize the following options for a Write File tool:
- Target Name: Determines how this tool names the file it creates. You can enter a specific name for a file, or use wildcards where appropriate. Acceptable wildcards include:
- %b: Base name of original file (no extension).
- %f: Original file name (with extension).
- %e: Extension of original file name.
- %u: Unique time-based ID.
- %d: Current date.
- %t: Current time.
- %n: Tool name.
- %i: Row index.
- Target Directory: Determines where this tool places the file it creates. You can choose to place the file within a File System or within a Workspace.
- Create directories: Determines whether the tool creates directories.
- Override directory from input: Determines whether this tool always saves files in the location specified in the Target Directory field. If this option is enabled, the tool will always save the file in the location specified in the Target Directory field. If this option is not enabled, the tool will try to save the file in the source file’s directory; if the tool cannot write to that directory, it will save the file in the location specified in the Target Directory field.
- Backup file before overwriting: Determines whether backup files are created before the modified file is saved over the previous version.
- Use UTF-8 encoding: Determines whether the tool writes files using UTF-8 encoding.
- Append: Determines whether the tool appends new content to the existing file instead of overwriting it.