256 views

Description

In ATF setting values to list collector variable is not working as expected

Steps to Reproduce

  1. Create a new test case in an affected instance
  2. Write an ATF step to open existing catalog item such as "Report Mass Outage"
  3. Write an ATF step to fill values to the catalog item using "Set Variable Values" step configuration.
  4. Write a step to submit catalog.
  5. Run the test case.
  6. The execution will fail with error "not able to submit as mandatory field is not filled."
  7. Failure is due to a mandatory field "Which Servers are impacted?" which is a list collector that is not filled during step 3.

We have provided sys_id in comma separated format as input parameter in step config.

Workaround

g_form.setValue() is not supported for List Collector Variable if it is of type slush bucket.

This is documented in the topic Types of service catalog variables.

List Collector with glide_list attribute works correctly with the g_form.setValue() api.

ATF uses the g_form API so, if g_form is not supported for a variable, the ATF for that Variable will not run.

The workaround for ATF is to set the Default Value of the variable as part of the ATF test. To do this, you need to add a new "Run Server Side Script" step to the BEGINNING of the test. Use this script:

(function(outputs, steps, stepResult, assertEqual) {
var gr = new GlideRecord('item_option_new');

// Change this to the sys ID of the List Collector variable
gr.get('f3563069db746300478cf23aaf96193b');

// Enter a comma-separated list of sys IDs for the desired values
gr.default_value = '1c741bd70b2322007518478d83673af3,85071a1347c12200e0ef563dbb9a71c1';

gr.update();
})(outputs, steps, stepResult, assertEqual);

NOTE: Both workarounds modify metadata and will affect all users. The Default Value approach will temporarily affect all users on that instance who are using this catalog item until the test is over.


Related Problem: PRB1250938

Seen In

Kingston

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-10-02 02:58:02
Published:2018-10-02