The Write File tool can convert output data to files. You can add the Write File tool to API testing and service virtualization components the output data, such as test assets, message responders, and other tools. This tool is also available in the desktop tools.
- Select a node for which you want to write output data.
- Choose Add Write File Tool from the actions drop-down menu.
- Configure the tool settings:
Target name: Specify a name for the target file or use wildcards. Acceptable wildcards include:
%b Base name of the 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 Test name. %i Row index. - Target directory: Specify where the tool saves the file it creates. Click in the filed and the auto-complete function will show available locations.
You can also enable the following options for the target directory:
Create directories Enable to allow the tool to create directories in the target directory.
Override directory from input Enable to allow the tool to always save files 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 Enable to allow the tool to backup files that are created before a modified file from a subsequent run is saved over the previous version. Use UTF-8 encoding Enable to configure UTF-8 encoding for the file. Append Enable to append new content to the existing file instead of overwriting it. Beautify XML output Enable to properly format XML that is collected and written to the file.
- If the extension tool is not attached to the output of another tool, you can specify an input for your script. Choose a MIME type from the drop-down menu and specify the text you want the tool to operate on.