ATF Run Server Side Script Outputs

ericgilmore
Tera Guru

Is it possible to pass values from a Run Server Side Script test step to proceeding test steps?

After investigating, and finding out that I had to ADD an Output Variable to the Run Server Side Script test step (Automated Test Framework > Administration > Step Configurations > Run Server Side Script > Output Variables), I thought this bit of code would allow me to actually obtain a field value and pass it to proceeding test steps, but no, this doesn't work.

(function(outputs, steps, params, stepResult, assertEqual) {
    var gr = new GlideRecord('problem');
    // gr.get(steps('0bc8dc5d1bd0bd10ee9420ecac4bcb4e').record_id);
	gr.addQuery('sys_id',steps('0bc8dc5d1bd0bd10ee9420ecac4bcb4e').record_id);
	gr.query();
	
	if(gr.next()) {
		outputs.u_jirakey = gr.u_jira_key;
		outputs.table = 'problem';
		// outputs.record_id = gr.insert();
		// outputs.table = 'problem';
	}

})(outputs, steps, params, stepResult, assertEqual);

 

I don't know if this SHOULD show up in the test results, but when I look at the results for this step I see this...
testStep.png

 

Anyone else run into this??

1 ACCEPTED SOLUTION

Elijah Aromola
Mega Sage

Have you attempted to set a static value for those two output variables in your script? Currently it is nested inside your query and I cannot determine if that query is just unsuccessful.

View solution in original post

2 REPLIES 2

Elijah Aromola
Mega Sage

Have you attempted to set a static value for those two output variables in your script? Currently it is nested inside your query and I cannot determine if that query is just unsuccessful.

I did and it worked with the static values. I was able to identify and extract the data I needed, but ultimately we went in another direction.