The Write to Delimited File step lets you save the current value of some properties in a CSV file. This step is commonly used when properties are shared among multiple test cases, or for debugging purposes when a test has failed. The properties can be existing properties or new properties. You can save existing properties under a different property name.
Complete the following fields:
Enter the path name of the file, or use the Browse button to browse to the file.
Accept the default encoding of UTF-8 or select an alternate encoding from the drop-down list.
If the encoding you select includes a Byte Order Mark, you can select this check box to include that BOM at the beginning of the file.
Enter the delimiter character to use for your file.
Select from the drop-down list the correct line end character for your file.
Click Add to add a row. Then enter the properties (Header) and corresponding values (Value) to save. Your list of properties can contain existing or new properties. When specifying existing properties (Header), you can override their current value by specifying a new value, or you can use their existing value.
In the previous example:
The properties are stored in a CSV file where the first line in the file is the set of property names being saved. The second line contains the values corresponding to each of the properties.
Note: This step is used to pass data between test cases. For example, assume Test1 adds customers to the bank and then returns a list of new account numbers. Those accounts could be written out to a file. A second test could get the accounts and could make deposits. The second test would use a data set to read in the file that was created in the first test.
Be aware of the following warning when writing to a delimited file. The Data directory can be used as the location of the CSV file only if both tests support rerun. The first test must be run again to create the CSV in the lads folder so the second test can run. The lads directory stores files temporarily while a test case or suite is running.
To let the second test run without the first, you must put the data set in a common location outside the project or MAR.
The Write to Delimited File step writes out one (and only one) data row for each execution. The only exception is on the first execution when (presumably) the target file does not exist. If the file does not exist, if indicated, a byte order mark for the selected encoding is written, followed by a row containing the keys.
The default name for the Write to Delimited File step is Write Properties to File <file>. 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.
Copyright © 2014 CA Technologies.
All rights reserved.
|
|