Custom Test Step Description (ATF)

Brian Lancaster
Tera Sage

I finally got around to figuring out how to setup the description for a custom test step. I have already used this test step in several ATF test. Is there a script I could run that would force the description to update on the test steps that were already setup? Right now it looks like I would have to make a change and save it. Then go back in and set it back to what it was for that particular test.

4 REPLIES 4

Ankush Agrawal
ServiceNow Employee
ServiceNow Employee

Hi Brian

It is possible if the script to generate the description can be run independently. The following will give the references to the desired ATF steps

var grStep = new GlideRecord('sys_atf_step');
grStep.addQuery('step_config', <sysIDOfCustomStepConfig>);
grStep.query();

Then let's say you have the function generateDescription that generates the description and takes a single parameter as GlideRecord pointing to the required Step. 

while(grStep.next())
   generateDescription(grStep);

 

--
Best Regards
Ankush

P.S. Please mark helpful/correct as appropriate to help the fellow community member in identifying the relevant answers.

If this is something I would have to run in script background it does not work. It error our in the while loop saying generateDescription is undefined.

That is an example name, sorry if I was not clear. Can you please first create the function generateDescription in background-script itself? It should contain the code you wrote to populate the description. 

If you can share the description generation code, I can try to give the complete code here which you can directly run in background-script.

--
Best regards
Ankush

That seems like a lot of extra coding as the generate script in the test step use steps. which would not be available in scripts background. I came up with something simple that worked when I tried it in dev and test.

var gr = new GlideRecord("sys_atf_step");
gr.addEncodedQuery("step_config=6fa596fcdbe3341053c0231c13961969");//sys_id of custom test step.
gr.query();
while(gr.next()){
   gr.setForceUpdate(true);
   gr.update();
}