Previous Topic: JUnit Test Case-SuiteNext Topic: External - FTP Step


Read a File (Disk URL or Classpath)

The Read a File step reads a file from your file system, a URL, or the classpath.

Files are used as a source of data for testing. This step can be paired with the Load a set of File Names data set to provide source data for testing.

You can read a text file or a binary file. The contents of the file can optionally be stored in a property.

Complete the following fields:

File

Enter the path name, a URL, or a classpath, or browse to the file using the Browse button.

File Encoding

Accept the default encoding of UTF-8 or select an alternate encoding from the drop-down list. You can also select Auto-detect and click the Detect button to have <ldtF> select an encoding type for you.

Property Key

Enter the name of the property in which to store the file contents (optional).

Load as Byte []

To load contents as a byte array, select this check box. This capability is useful when loading a file to be used as a binaryData type in a web service execution parameter.

If environment error

Select the step to redirect to if the Read a File test fails.

Display as characters

The contents are displayed as hexadecimal encoded bytes unless you select this check box. This check box is only visible if the Load as Byte [] box is selected.

Click Load to load and display the file. The content is now ready for you to filter and add assertions.

Note: If a binary file is loaded but you do not select to load as byte, DevTest converts the data to characters (many of which are unreadable) and the step response is a string.

The Read a File step has a default name using this convention: Read file [set the File Name variable]. If another step uses the default step name, DevTest appends a number to this step name to keep it unique. You can change step names at any time.