Using empty collections in test suites
By defining a custom Excel property, you can have empty cells in test suites treated as
empty collections instead of null objects or null object fields.
About this task
When you define the input parameters and the expected values in an Excel scenario file, you fill in the table cells that correspond to an object or an object field.
By default, when you leave a cell empty, you get the following results:
- When the cell is related to input parameters, you get a null object or a null object field.
- When the cell is related to expected values that are defined in the Expected Results sheet, a test is ignored when the scenario file is used.
These results apply to any data type, including arrays and collections. For input parameters, for example, the resulting arrays or collections are null if the cells are empty.
You can use the custom Excel property create.empty.collections to create empty arrays or collections for empty cells. The property uses the following values:
| Value | Behavior |
|---|---|
| NEVER (default) | The default behavior, empty cells lead to null values for collections when related to input parameters, and to tests being ignored when related to expected values. This is the legacy behavior. |
| ALWAYS_BOTH_SCENARIOS_AND_EXPECTED_RESULTS | Empty cells always lead to the creation of empty collections. For expected values, the tests are not ignored. They are run, and the expected value is an empty collection. |
| ALWAYS_SCENARIOS_ONLY | Empty cells lead to the creation of empty collections for input parameters only. For expected values, tests are ignored. |
Tip: The create.empty.collections property does not exist in Excel
scenario files from older versions of the product. When this is the case, you can manually define
the property in your existing Excel scenario file, or generate a new Excel scenario file to use the
property.
Procedure
To use the create.empty.collections property: