In a step configuration record, the step description generation script field determines the step description that the system generates when a step of this type is added to a test.

For an example showing how where the description generated by this script appears, see Description generation script example.

Step

The step parameter to generateDescription() gives the script access to the step object, which it turn gives access to the input variables as defined in the step configuration record. (Input variables are defined in a related list.)

For example, if – in a step config record – the inputs related list contains two records: var1 and var2, the script can reference var1 with the expression step.inputs.var1 and can reference var2 with step.inputs.var2.

Example: Record Query description generation script


    (function generateDescription(step) {
    var td = GlideTableDescriptor.get(step.inputs.table);
    if (!td) {
         gs.log("Invalid table name in test step: " + step.inputs.table);
         return gs.getMessage("Set field values");
    }
    var descriptionGenerator = new ATFStepDescriptionGenerator();
    var description = gs.getMessage("There should be at least one record in '{0}' matching " +
                      "a query of\n{1}",
                      [step.inputs.table.getDisplayValue(),
                      descriptionGenerator.getConditionDescription(step.inputs.table, step.inputs.field_values)]);
    
    return description;
    })(step);