Standard Change Request Validation through Automated Testing Framework

Feddy
Kilo Sage

Hi Everyone,

We have a requirement where we need to test a  Standard change request validation through ServiceNow ATF.
We have followed the below link:
1. https://greg-grabowski.com/test-standard-change-automated-test-framework/

2.https://greg-grabowski.com/test-standard-change-automated-test-framework-part-2/.


The issues which we are facing is that the default value of the change request type is set to standard(by following the above link), so we couldn't able to perform other tests where we need to test other change types.
is there any workaround to test standard change request.

Thanks.

1 ACCEPTED SOLUTION

Ankush Agrawal
ServiceNow Employee
ServiceNow Employee

Hi Fedrick

You can use the query in the below format:

var standardTemplate = new GlideRecord('std_change_record_producer');
standardTemplate.addQuery('active', true);
//You can also add a query to get the required template
standardTemplate.query();
standardTemplate.next();
var gr = new GlideRecord('change_request');
gr.applyTemplate(String(standardTemplate.template.name)); //This step applies the queried template
gr.setValue('type', 'standard');
gr.setValue('short_description', 'This is my short descr');
var sysID = gr.insert();

--

Cheers

Ankush

View solution in original post

6 REPLIES 6

Hi Ankush,
 It really worked for us. Thanks for your replies.
I have posted a another question regarding "Risk assessment"( https://community.servicenow.com/community?id=community_question&sys_id=c00a9c35db152b00107d5583ca9619e9). 
Please guide me on the same.

Much appreciated,
Fedrick

Ankush Agrawal
ServiceNow Employee
ServiceNow Employee

Just replied to that too 🙂