-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatf_step_debug_helper.xml
More file actions
108 lines (98 loc) · 4.08 KB
/
atf_step_debug_helper.xml
File metadata and controls
108 lines (98 loc) · 4.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?xml version="1.0" encoding="UTF-8"?>
<unload unload_date="2020-07-21 09:43:35">
<sys_atf_step_config action="INSERT_OR_UPDATE">
<active>true</active>
<batch_order_constraint/>
<can_mutate_page>false</can_mutate_page>
<category display_value="Server">317c4dc20b202200a8d7a12cf6673aa8</category>
<class_name/>
<class_type>script</class_type>
<deprecated>false</deprecated>
<description_generator><![CDATA[(function generateDescription(step) {
var descriptionGenerator = new ATFStepDescriptionGenerator();
var description;
if (step.inputs.u_continue)
description = gs.getMessage("Wait for {0} seconds, continue with script if step times out.",
[step.inputs.u_timeout]);
else
description = gs.getMessage("Wait for {0} seconds, terminate script if step times out.",
[step.inputs.u_timeout]);
description += descriptionGenerator.getTimeoutDescription(step.timeout);
return description;
})(step);]]></description_generator>
<html_description><![CDATA[<p>Create an incident record and wait for the state to change to "In Progress". </p>
<p>The step can be configured to continue or terminate the script if the record is not updated.</p>]]></html_description>
<icon>icon-article-document</icon>
<inputs/>
<name>Debug Helper</name>
<order>100</order>
<outputs/>
<step_env display_value="Server - Independent">6c2bcea1870312009dccc9ded0e3ecca</step_env>
<step_execution_generator><![CDATA[(function executeStep(inputs, outputs, stepResult, timeout) {
var mandatoryVariableMessage = "{0} was not specified";
if (gs.nil(inputs.u_timeout)) {
stepResult.setOutputMessage(gs.getMessage(mandatoryVariableMessage, 'Timeout'));
stepResult.setFailed();
return;
}
var short_description = "TU-ATF-DEBUG Update the state to 'In Progress' stop this debug step.";
// create a temporary incident and set the short description to indicate thats its for ATF
var gr_Incident = new GlideRecord("incident");
gr_Incident.initialize();
gr_Incident.setValue("caller_id", gs.getUserID());
gr_Incident.setValue("short_description", short_description);
gr_Incident.update();
var test_id = gr_Incident.sys_id;
var gr_Query = new GlideRecord("incident");
var counter = 0;
while (counter <= inputs.u_timeout) {
gr_Query.initialize();
gr_Query.addQuery("short_description", short_description);
gr_Query.addQuery("state", "2");
gr_Query._query();
if (gr_Query._next()) {
stepResult.setOutputMessage(gs.getMessage("Test record found, debug step terminated"));
stepResult.setSuccess();
// no match found, tidy up the test record
gr_Incident = new GlideRecord("incident");
if (gr_Incident.get(test_id)) {
gr_Incident.deleteRecord();
}
return;
}
counter++;
sn_atf.AutomatedTestingFramework.waitOneSecond();
}
// no match found, tidy up the test record
gr_Incident = new GlideRecord("incident");
if (gr_Incident.get(test_id)) {
gr_Incident.deleteRecord();
}
if (inputs.u_continue) {
// need to continue with the script
stepResult.setOutputMessage(gs.getMessage("No test record found, continuing with script."));
stepResult.setSuccess();
return;
} else {
stepResult.setOutputMessage(gs.getMessage("No test record found, terminating script."));
stepResult.setFailed();
}
}(inputs, outputs, stepResult, timeout));
]]></step_execution_generator>
<sys_class_name>sys_atf_step_config</sys_class_name>
<sys_created_by>admin</sys_created_by>
<sys_created_on>2019-02-08 09:03:52</sys_created_on>
<sys_id>810e557c4fa3a3007f0ac98e9310c775</sys_id>
<sys_mod_count>8</sys_mod_count>
<sys_name>Debug Helper</sys_name>
<sys_package display_value="Global" source="global">global</sys_package>
<sys_policy/>
<sys_scope display_value="Global">global</sys_scope>
<sys_update_name>sys_atf_step_config_810e557c4fa3a3007f0ac98e9310c775</sys_update_name>
<sys_updated_by>aidan.cooper</sys_updated_by>
<sys_updated_on>2020-07-21 09:30:24</sys_updated_on>
<template_reminder>Custom step to create artificial pause in the test to allowing for debugging</template_reminder>
<type display_value="Test Step" name="sys_atf_step">b9c7092ead2410100c1dae772a4a75ea</type>
<wizard_redirect/>
</sys_atf_step_config>
</unload>