1#!/usr/bin/env python3
2# coding=utf-8
3
4#
5# Copyright (c) 2022 Huawei Device Co., Ltd.
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10#     http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18
19import warnings
20warnings.warn("this module is deprecated, use 'devicetest.error' instead", DeprecationWarning)
21
22
23class DetailErrorMassage:
24    Error_01100 = {
25        "Topic": "测试资源加载异常[01100]",
26        "Code": "01100",
27        "Message": {
28            "en": "The third-party Python library or key AW of the test "
29                  "suite is missing or the script syntax is incorrect. "
30                  "As a result, the test suite fails to be loaded. {}",
31            "ch": "测试套的Python三方库、关键AW缺失或脚本语法错误,导致测试套加载失败."
32        }
33    }
34
35    Error_01101 = {
36        "Topic": "测试资源加载异常[01101]",
37        "Code": "01101",
38        "Message": {
39            "en": "An error occurred when parsing AW parameters during "
40                  "script execution (parameter syntax error or method "
41                  "parameter inconsistency).",
42            "ch": "执行脚本过程中解析AW参数出错(参数语法错误,方法参数不一致)."
43        }
44    }
45
46    Error_01102 = {
47        "Topic": "测试资源加载异常[01102]",
48        "Code": "01102",
49        "Message": {
50            "en": "The dependent file resource (video resource file) is "
51                  "missing during task execution.",
52            "ch": "任务执行过程中,依赖的文件资源缺失(视频资源文件)."
53        }
54    }
55
56    Error_01105 = {
57        "Topic": "测试资源加载异常[01105]",
58        "Code": "01105",
59        "Message": {
60            "en": "The CPU of the mobile phone does not depend on "
61                  "the HiSilicon chip during network packet capture.",
62            "ch": "网络报文抓取时,依赖的手机CPU不是海思芯片."
63        }
64    }
65
66    Error_01107 = {
67        "Topic": "测试用例执行失败[01107]",
68        "Code": "01107",
69        "Message": {
70            "en": "Wi-Fi is not enabled.",
71            "ch": "未打开WiFi."
72        }
73    }
74
75    Error_01108 = {
76        "Topic": "测试资源加载异常[01108]",
77        "Code": "01108",
78        "Message": {
79            "en": "model_aw import resource error.",
80            "ch": "model_aw 引入资源时发生错误."
81        }
82    }
83
84    Error_01109 = {
85        "Topic": "测试资源加载异常[01109]",
86        "Code": "01109",
87        "Message": {
88            "en": "hierachyview module import error.",
89            "ch": "hierachyview 模块引入时发生错误."
90        }
91    }
92
93    Error_01110 = {
94        "Topic": "测试资源加载异常[01110]",
95        "Code": "01110",
96        "Message": {
97            "en": "error, test suite not found py script.",
98            "ch": "testsuite用例没有找到目标py用例."
99        }
100    }
101
102    Error_01200 = {
103        "Topic": "测试用例执行失败[01200]",
104        "Code": "01200",
105        "Message": {
106            "en": "No error message is set in the script, and the actual "
107                  "value of the check point is different from the expected "
108                  "value. {}",
109            "ch": "脚本没有设置错误提示信息,检查点的实际输入值与预期结果不一致."
110        }
111    }
112
113    Error_01201 = {
114        "Topic": "测试用例执行失败[01201]",
115        "Code": "01201",
116        "Message": {
117            "en": "The manual submission result is incorrect.",
118            "ch": "手动提交的步骤结果不正确."
119        }
120    }
121
122    Error_01202 = {
123        "Topic": "测试用例执行失败[01202]",
124        "Code": "01202",
125        "Message": {
126            "en": "An unknown error occurred when running the setup command.",
127            "ch": "执行setup遇到未知错误."
128        }
129    }
130
131    Error_01203 = {
132        "Topic": "测试用例执行失败[01203]",
133        "Code": "01203",
134        "Message": {
135            "en": "An unknown error occurred when running the test command.",
136            "ch": "执行test遇到未知错误."
137        }
138    }
139
140    Error_01204 = {
141        "Topic": "测试用例执行失败[01204]",
142        "Code": "01204",
143        "Message": {
144            "en": "An unknown error occurred when running the teardown "
145                  "command.",
146            "ch": "执行teardown遇到未知错误."
147        }
148    }
149
150    Error_01205 = {
151        "Topic": "测试用例执行失败[01205]",
152        "Code": "01205",
153        "Message": {
154            "en": "An unexpected error occurs during the execution of "
155                  "the current case.",
156            "ch": "当前用例执行出现非预期的错误."
157        }
158    }
159
160    Error_01206 = {
161        "Topic": "测试用例执行失败[01206]",
162        "Code": "01206",
163        "Message": {
164            "en": "An error is reported when the connector command is executed.",
165            "ch": "执行connector命令异常报错."
166        }
167    }
168
169    Error_01207 = {
170        "Topic": "测试用例执行失败[01207]",
171        "Code": "01207",
172        "Message": {
173            "en": "generate test report failed.",
174            "ch": "生成xml报告失败."
175        }
176    }
177
178    Error_01208 = {
179        "Topic": "测试用例执行失败[01208]",
180        "Code": "01207",
181        "Message": {
182            "en": "Failed to obtain the idle port.",
183            "ch": "获取connector空闲端口失败."
184        }
185    }
186
187    Error_01209 = {
188        "Topic": "测试用例执行失败[01209]",
189        "Code": "01209",
190        "Message": {
191            "en": "An exception occurred when parsing parameters in the "
192                  "current aw step.",
193            "ch": "当前aw步骤的参数解析异常."
194        }
195    }
196
197    Error_01210 = {
198        "Topic": "测试用例执行失败[01210]",
199        "Code": "01210",
200        "Message": {
201            "en": "An exception occurred when executing the current aw step.",
202            "ch": "当前aw步骤的执行异常."
203        }
204    }
205
206    Error_01211 = {
207        "Topic": "测试用例执行失败[01211]",
208        "Code": "01211",
209        "Message": {
210            "en": "Failed to connect to the device:The device goes offline.",
211            "ch": "连接设备失败:设备掉线."
212        }
213    }
214
215    Error_01212 = {
216        "Topic": "测试用例执行失败[01212]",
217        "Code": "01212",
218        "Message": {
219            "en": "Running the connector command times out.",
220            "ch": "执行connector命令超时."
221        }
222    }
223
224    Error_01213 = {
225        "Topic": "测试用例执行失败[01213]",
226        "Code": "01213",
227        "Message": {
228            "en": "Failed to install the App.",
229            "ch": "App安装失败."
230        }
231    }
232
233    Error_01214 = {
234        "Topic": "测试用例执行失败[01214]",
235        "Code": "01214",
236        "Message": {
237            "en": "with open write file content Failed.",
238            "ch": "打开并写入文件内容失败."
239        }
240    }
241
242    Error_01215 = {
243        "Topic": "测试用例执行失败[01215]",
244        "Code": "01215",
245        "Message": {
246            "en": "with open read file content Failed.",
247            "ch": "打开并读取文件内容失败."
248        }
249    }
250
251    Error_01216 = {
252        "Topic": "测试用例执行失败[01216]",
253        "Code": "01216",
254        "Message": {
255            "en": "with open read file: No such file.",
256            "ch": "读文件时文件不存在."
257        }
258    }
259
260    Error_01217 = {
261        "Topic": "测试用例执行失败[01217]",
262        "Code": "01217",
263        "Message": {
264            "en": "device not found:The test mobile phone is disconnected.",
265            "ch": "设备未找到:测试手机断连."
266        }
267    }
268
269    Error_01218 = {
270        "Topic": "测试用例执行失败[01218]",
271        "Code": "01218",
272        "Message": {
273            "en": "Failed to initialize the device object in the TestCase.",
274            "ch": "TestCase初始化设备对象异常."
275        }
276    }
277    ##########################################################################
278    # root 相应接口错误码
279
280    Error_01239 = {
281        "Topic": "测试用例执行失败[01239]",
282        "Code": "01239",
283        "Message": {
284            "en": "Can't get StatusBar height {}.",
285            "ch": "无法获取状态栏高度."
286        }
287    }
288
289    Error_01240 = {
290        "Topic": "测试用例执行失败[01240]",
291        "Code": "01240",
292        "Message": {
293            "en": "failed to refresh StatusBar.",
294            "ch": "刷新状态栏失败."
295        }
296    }
297
298    Error_01241 = {
299        "Topic": "测试用例执行失败[01241]",
300        "Code": "01241",
301        "Message": {
302            "en": "Widget don't have property {}.",
303            "ch": "工具没有对应属性."
304        }
305    }
306
307    Error_01242 = {
308        "Topic": "测试用例执行失败[01242]",
309        "Code": "01242",
310        "Message": {
311            "en": "can't get window named {} from device {}.",
312            "ch": "无法从设备获取指定的窗口."
313        }
314    }
315
316    Error_01243 = {
317        "Topic": "测试用例执行失败[01243]",
318        "Code": "01243",
319        "Message": {
320            "en": "get Focused WindowId Exception.",
321            "ch": "获取焦点窗口ID异常."
322        }
323    }
324
325    Error_01244 = {
326        "Topic": "测试用例执行失败[01244]",
327        "Code": "01244",
328        "Message": {
329            "en": "Unable to get the focused window name from device {}.",
330            "ch": "找到的视图节点不可见."
331        }
332    }
333
334    Error_01245 = {
335        "Topic": "测试用例执行失败[01245]",
336        "Code": "01245",
337        "Message": {
338            "en": "Finded viewnode with {} is not visible.",
339            "ch": "找到的视图节点不可见."
340        }
341    }
342
343    Error_01246 = {
344        "Topic": "测试用例执行失败[01246]",
345        "Code": "01246",
346        "Message": {
347            "en": "Not find viewnode with {}.",
348            "ch": "未找到对应视图节点."
349        }
350    }
351
352    Error_01247 = {
353        "Topic": "测试用例执行失败[01247]",
354        "Code": "01247",
355        "Message": {
356            "en": "cannot find viewnode with property {}.{}.",
357            "ch": "找不到具有属性的视图节点."
358        }
359    }
360
361    Error_01248 = {
362        "Topic": "测试用例执行失败[01248]",
363        "Code": "01248",
364        "Message": {
365            "en": "ViewNode is none.",
366            "ch": "目标控件对象为None."
367        }
368    }
369
370    Error_01249 = {
371        "Topic": "测试用例执行失败[01249]",
372        "Code": "01249",
373        "Message": {
374            "en": "parse View Hierarchy Exception.",
375            "ch": "解析视图层次结构异常."
376        }
377    }
378
379    Error_01250 = {
380        "Topic": "测试用例执行失败[01250]",
381        "Code": "01250",
382        "Message": {
383            "en": "load Window Data Exception.",
384            "ch": "获取视图数据异常."
385        }
386    }
387
388    Error_01251 = {
389        "Topic": "测试用例执行失败[01251]",
390        "Code": "01251",
391        "Message": {
392            "en": "get Focused Window Exception.",
393            "ch": "获取焦点窗口异常."
394        }
395    }
396
397    Error_01252 = {
398        "Topic": "测试用例执行失败[01252]",
399        "Code": "01252",
400        "Message": {
401            "en": "Load Windows Exception.",
402            "ch": "加载Windows服务异常."
403        }
404    }
405
406    Error_01253 = {
407        "Topic": "测试用例执行失败[01253]",
408        "Code": "01253",
409        "Message": {
410            "en": "stop View Server Failed.",
411            "ch": "停止视图服务失败."
412        }
413    }
414
415    Error_01254 = {
416        "Topic": "测试用例执行失败[01254]",
417        "Code": "01254",
418        "Message": {
419            "en": "start View Server Failed.",
420            "ch": "启动视图服务失败."
421        }
422    }
423
424    Error_01255 = {
425        "Topic": "测试用例执行失败[01255]",
426        "Code": "01255",
427        "Message": {
428            "en": "service call window 3 error.",
429            "ch": "服务调用窗口3错误."
430        }
431    }
432
433    Error_01256 = {
434        "Topic": "测试用例执行失败[01256]",
435        "Code": "01256",
436        "Message": {
437            "en": "setup Device Forward Failed.",
438            "ch": "设置设备转发失败."
439        }
440    }
441
442    Error_01257 = {
443        "Topic": "测试用例执行失败[01257]",
444        "Code": "01257",
445        "Message": {
446            "en": "Cannot forward to view server.",
447            "ch": "无法转发到查看服务器."
448        }
449    }
450
451    Error_01258 = {
452        "Topic": "测试用例执行失败[01258]",
453        "Code": "01258",
454        "Message": {
455            "en": "Could not connect to the view server.",
456            "ch": "无法连接到视图服务器."
457        }
458    }
459
460    Error_01259 = {
461        "Topic": "测试用例执行失败[01259]",
462        "Code": "01259",
463        "Message": {
464            "en": "Failed to create socket connection with view server.",
465            "ch": "创建与视图服务器的套接字连接失败."
466        }
467    }
468
469    ##########################################################################
470    # 业务使用
471
472    Error_01260 = {
473        "Topic": "测试用例执行失败[01260]",
474        "Code": "01260",
475        "Message": {
476            "en": "Assertion Error: Two objects determined by '==' are "
477                  "unequal,{}",
478            "ch": "断言错误: 由'=='确定的两个对象不相等."
479        }
480    }
481
482    Error_01261 = {
483        "Topic": "测试用例执行失败[01261]",
484        "Code": "01261",
485        "Message": {
486            "en": "Assertion Error: Two objects determined by '!=' are "
487                  "equal,{}",
488            "ch": "断言错误: 由'!='确定的两个对象相等."
489        }
490    }
491
492    Error_01262 = {
493        "Topic": "测试用例执行失败[01262]",
494        "Code": "01262",
495        "Message": {
496            "en": "Assertion Error: The asserted object is not false,{}",
497            "ch": "断言错误: 检查的对象不为false."
498        }
499    }
500
501    Error_01263 = {
502        "Topic": "测试用例执行失败[01263]",
503        "Code": "01263",
504        "Message": {
505            "en": "Assertion Error: The asserted object is not true.,{}",
506            "ch": "断言错误: 检查的对象不为true."
507        }
508    }
509
510    Error_01264 = {
511        "Topic": "测试用例执行失败[01264]",
512        "Code": "01264",
513        "Message": {
514            "en": "Assertion Error: The asserted object1 is not object2,{}",
515            "ch": "断言错误: 断言的对象1不是对象2."
516        }
517    }
518
519    Error_01265 = {
520        "Topic": "测试用例执行失败[01265]",
521        "Code": "01265",
522        "Message": {
523            "en": "Assertion Error: The asserted object1 is object2,{}",
524            "ch": "断言错误: 断言的对象1是对象2."
525        }
526    }
527
528    Error_01266 = {
529        "Topic": "测试用例执行失败[01266]",
530        "Code": "01266",
531        "Message": {
532            "en": "Assertion error: The asserted object is not None,{}",
533            "ch": "断言错误: 断言的对象不为None."
534        }
535    }
536
537    Error_01267 = {
538        "Topic": "测试用例执行失败[01267]",
539        "Code": "01267",
540        "Message": {
541            "en": "Assertion error: The asserted object is None,{}",
542            "ch": "断言错误: 断言的对象为None."
543        }
544    }
545
546    Error_01268 = {
547        "Topic": "测试用例执行失败[01268]",
548        "Code": "01268",
549        "Message": {
550            "en": "Assertion error: The asserted object1not in object2,{}",
551            "ch": "断言错误: 断言的对象1不在对象2中."
552        }
553    }
554
555    Error_01269 = {
556        "Topic": "测试用例执行失败[01269]",
557        "Code": "01269",
558        "Message": {
559            "en": "Assertion error: The asserted object1 in object2,{}",
560            "ch": "断言错误: 断言的对象1在对象2中."
561        }
562    }
563
564    Error_01270 = {
565        "Topic": "测试用例执行失败[01270]",
566        "Code": "01270",
567        "Message": {
568            "en": "Assertion error: The asserted object1 is not an instance "
569                  "of object2,{}",
570            "ch": "断言错误: 断言的对象1不是对象2的实例."
571        }
572    }
573
574    Error_01271 = {
575        "Topic": "测试用例执行失败[01271]",
576        "Code": "01271",
577        "Message": {
578            "en": "Assertion error: The asserted object1 is an instance of "
579                  "object2,{}",
580            "ch": "断言错误: 断言的对象1是对象2的实例."
581        }
582    }
583
584    Error_01272 = {
585        "Topic": "测试用例执行失败[01272]",
586        "Code": "01272",
587        "Message": {
588            "en": "Assertion error: The difference between object1 and "
589                  "object2 is not within the expected range,{}",
590            "ch": "断言错误: 断言的对象1与对象2的差值不在预期的范围内."
591        }
592    }
593
594    Error_01273 = {
595        "Topic": "测试用例执行失败[01273]",
596        "Code": "01273",
597        "Message": {
598            "en": "Assertion error: The difference between object1 and "
599                  "object2 is not within the expected range,{}",
600            "ch": "断言错误: 断言的对象1与对象2的差值不在预期的范围外."
601        }
602    }
603
604    Error_01274 = {
605        "Topic": "测试用例执行失败[01274]",
606        "Code": "01274",
607        "Message": {
608            "en": "Assertion error: The asserted object1 is not "
609                  "greater than object2,{}",
610            "ch": "断言错误: 断言的对象1小于等于对象2."
611        }
612    }
613
614    Error_01275 = {
615        "Topic": "测试用例执行失败[01275]",
616        "Code": "01275",
617        "Message": {
618            "en": "Assertion error: The asserted object1 is not "
619                  "greater than or equal to object2,{}",
620            "ch": "断言错误: 断言的对象1小于对象2."
621        }
622    }
623
624    Error_01276 = {
625        "Topic": "测试用例执行失败[01276]",
626        "Code": "01276",
627        "Message": {
628            "en": "Assertion error: The asserted object1 is not less than to "
629                  "object2,{}",
630            "ch": "断言错误: 断言的对象1大于等于对象2."
631        }
632    }
633
634    Error_01277 = {
635        "Topic": "测试用例执行失败[01277]",
636        "Code": "01277",
637        "Message": {
638            "en": "Assertion error: The asserted object1 is not "
639                  "less than or equal to object2,{}",
640            "ch": "断言错误: 断言的对象1大于对象2."
641        }
642    }
643
644    Error_01278 = {
645        "Topic": "测试用例执行失败[01278]",
646        "Code": "01278",
647        "Message": {
648            "en": "Assertion error: The asserted of two dict objects "
649                  "unequal,{}",
650            "ch": "断言错误: 断言的两个字典对象不相等."
651        }
652    }
653
654    Error_01279 = {
655        "Topic": "测试用例执行失败[01279]",
656        "Code": "01279",
657        "Message": {
658            "en": "Assertion error: The asserted of two set objects "
659                  "unequal,{}",
660            "ch": "断言错误: 断言的两个集合对象不相等."
661        }
662    }
663
664    Error_01280 = {
665        "Topic": "测试用例执行失败[01280]",
666        "Code": "01280",
667        "Message": {
668            "en": "Assertion error: The asserted of two tuple objects "
669                  "unequal,{}",
670            "ch": "断言错误: 断言的两个元组对象不相等."
671        }
672    }
673
674    Error_01281 = {
675        "Topic": "测试用例执行失败[01281]",
676        "Code": "01281",
677        "Message": {
678            "en": "Assertion error: The asserted of two list objects "
679                  "unequal,{}",
680            "ch": "断言错误: 断言的两个列表对象不相等."
681        }
682    }
683
684    Error_01282 = {
685        "Topic": "测试用例执行失败[01282]",
686        "Code": "01282",
687        "Message": {
688            "en": "Assertion error: The asserted of two sequence objects "
689                  "unequal,{}",
690            "ch": "断言错误: 断言的两个序列对象不相等."
691        }
692    }
693
694    Error_01283 = {
695        "Topic": "测试用例执行失败[01283]",
696        "Code": "01283",
697        "Message": {
698            "en": "Assertion error: Assert that two multi-line strings are "
699                  "unequal,{}",
700            "ch": "断言错误: 断言两个多行字符串不相等."
701        }
702    }
703
704    ##########################################################################
705
706    Error_01300 = {
707        "Topic": "测试任务被人工中止[01300]",
708        "Code": "01300",
709        "Message": {
710            "en": "A user manually terminates the current task on "
711                  "the DECC GUI.",
712            "ch": "用户在DECC界面上手动终止当前的任务执行."
713        }
714    }
715
716    Error_01301 = {
717        "Topic": "测试任务被人工中止[01301]",
718        "Code": "01301",
719        "Message": {
720            "en": "The test case is not executed(the task is manually "
721                  "stopped).",
722            "ch": "用例未执行(任务被手动停止)."
723        }
724    }
725
726    Error_01400 = {
727        "Topic": "测试任务被异常中止[01400]",
728        "Code": "01400",
729        "Message": {
730            "en": "An unexpected error occurs in the tool.",
731            "ch": "工具内部出现非预期的错误."
732        }
733    }
734
735    Error_01401 = {
736        "Topic": "测试任务被异常中止[01401]",
737        "Code": "01401",
738        "Message": {
739            "en": "The connector is disconnected and fails to be reconnected for "
740                  "10 consecutive times.",
741            "ch": "connector连接断链,连续10次重连失败."
742        }
743    }
744
745    Error_01402 = {
746        "Topic": "测试任务被异常中止[01402]",
747        "Code": "01402",
748        "Message": {
749            "en": "The Agent scocket service exits abnormally: Failed to "
750                  "parse the DECC IDE command message.",
751            "ch": "Agent scoket服务异常退出:解析DECC IDE命令消息失败."
752        }
753    }
754
755    Error_01403 = {
756        "Topic": "测试任务被异常中止[01403]",
757        "Code": "01403",
758        "Message": {
759            "en": "The Agent scocket service exits abnormally: Failed to "
760                  "decrypt the socket authentication message.",
761            "ch": "Agent scoket服务异常退出:socket认证消息解密失败."
762        }
763    }
764
765    Error_01404 = {
766        "Topic": "测试任务被异常中止[01404]",
767        "Code": "01404",
768        "Message": {
769            "en": "The test case is not executed(an unexpected error occurs "
770                  "in the tool).",
771            "ch": "用例未执行(工具内部出现非预期的错误)."
772        }
773    }
774
775    Error_01405 = {
776        "Topic": "测试任务被异常中止[01405]",
777        "Code": "01405",
778        "Message": {
779            "en": "Dry-run failed: An error is during {} script query.",
780            "ch": "dry-run失败:查找{}脚本出错."
781        }
782    }
783
784    Error_01406 = {
785        "Topic": "测试任务被异常中止[01406]",
786        "Code": "01406",
787        "Message": {
788            "en": "Failed to start the xdevice service: Failed to load the "
789                  "xdevice-extension extension module.",
790            "ch": "拉起xdevice服务失败:加载xdevice-extension扩展模块失败."
791        }
792    }
793
794    Error_01407 = {
795        "Topic": "测试任务被异常中止[01407]",
796        "Code": "01407",
797        "Message": {
798            "en": "Dry-run failed: The syntax format of statement in '{}'.py "
799                  "is wrong when parse step parameter, please check! "
800                  "statement:{}.",
801            "ch": "dry-run失败:在解析step parameter时,'{}'.py中语句的语法格式错"
802                  "误,请检查,语句:{}."
803        }
804    }
805
806    Error_01408 = {
807        "Topic": "测试任务被异常中止[01408]",
808        "Code": "01408",
809        "Message": {
810            "en": "Dry-run failed: The syntax format of statement in '{}'.py "
811                  "is wrong when parse step content, please check! "
812                  "statement:{}.",
813            "ch": "dry-run失败:在解析step content时,'{}'.py中语句的语法格式错误,"
814                  "请检查!声明:{}."
815        }
816    }
817
818    Error_01409 = {
819        "Topic": "测试任务被异常中止[01409]",
820        "Code": "01409",
821        "Message": {
822            "en": "Dry-run failed: The script '{}.py/pyd' not exist, "
823                  "please check!",
824            "ch": "dry-run失败:脚本'{}.py/pyd'不存在,请检查!"
825        }
826    }
827    Error_01410 = {
828        "Topic": "测试任务被异常中止[01410]",
829        "Code": "01410",
830        "Message": {
831            "en": "Dry-run failed: Load script {} failed!",
832            "ch": "dry-run失败:加载脚本{}失败!"
833        }
834    }
835
836    Error_01411 = {
837        "Topic": "测试任务被异常中止[01411]",
838        "Code": "01411",
839        "Message": {
840            "en": "The Agent scocket service exits abnormally: "
841                  "An error is reported when the socket message is parsed.",
842            "ch": "Agent scoket服务异常退出:socket消息解析处理异常报错."
843        }
844    }
845
846    Error_01412 = {
847        "Topic": "测试任务被异常中止[01412]",
848        "Code": "01412",
849        "Message": {
850            "en": "Environment configuration error: The message format of "
851                  "environment configuration is wrong. Please check.",
852            "ch": "环境配置异常:环境配置消息格式错误,请查一下."
853        }
854    }
855
856    Error_01413 = {
857        "Topic": "测试任务被异常中止[01413]",
858        "Code": "01413",
859        "Message": {
860            "en": "Environment configuration error: The workspace path {} "
861                  "delivered by the client does not exist.",
862            "ch": "环境配置异常:客户端下发的工作路径xxx不存在!"
863        }
864    }
865
866    Error_01414 = {
867        "Topic": "测试任务被异常中止[01414]",
868        "Code": "01414",
869        "Message": {
870            "en": "Environment configuration error: test suite type error, "
871                  "not in ['Kit', 'OS'].",
872            "ch": "环境配置异常:测试套件类型不在【'Kit', 'OS'】中."
873        }
874    }
875
876    Error_01415 = {
877        "Topic": "测试任务被异常中止[01415]",
878        "Code": "01415",
879        "Message": {
880            "en": "Environment configuration error: The type of the param "
881                  "parameter "
882                  "delivered by the client is incorrect, which is not a "
883                  "known dictionary type.",
884            "ch": "环境配置异常:客户端下发的param参数类型错误,不是已知的字典类型."
885        }
886    }
887
888    Error_01416 = {
889        "Topic": "测试任务被异常中止[01416]",
890        "Code": "01416",
891        "Message": {
892            "en": "Dry-run failed: An unknown exception occurred during "
893                  "the dry-run process.",
894            "ch": "dry-run失败:dry-run过程出现未知异常."
895        }
896    }
897
898    Error_01417 = {
899        "Topic": "测试任务被异常中止[01417]",
900        "Code": "01417",
901        "Message": {
902            "en": "Failed to start the Agent service task because no "
903                  "environment is configured before the task is started.",
904            "ch": "Agent服务启动任务失败:启动任务前没有配置环境"
905        }
906    }
907
908    Error_01418 = {
909        "Topic": "测试任务被异常中止[01418]",
910        "Code": "01418",
911        "Message": {
912            "en": "An error is reported when the Agent service is started.",
913            "ch": "Agent服务启动任务异常报错."
914        }
915    }
916
917    Error_01419 = {
918        "Topic": "测试任务被异常中止[01419]",
919        "Code": "01419",
920        "Message": {
921            "en": "Agent server pull xdevice runner failed.",
922            "ch": "Agent服务拉取xdevice服务失败."
923        }
924    }
925
926    Error_01420 = {
927        "Topic": "测试任务被异常中止[01420]",
928        "Code": "01420",
929        "Message": {
930            "en": "Agent server start task retry failed.",
931            "ch": "Agent服务启动任务重试失败."
932        }
933    }
934
935    Error_01421 = {
936        "Topic": "测试任务被异常中止[01421]",
937        "Code": "01421",
938        "Message": {
939            "en": "Failed to update the XML Report Str.",
940            "ch": "更新xml report str失败."
941        }
942    }
943
944    Error_01422 = {
945        "Topic": "测试任务被异常中止[01422]",
946        "Code": "01422",
947        "Message": {
948            "en": "Failed to start xdevice agent service: An unknown "
949                  "exception was encountered.",
950            "ch": "启动xdevice agent服务失败:遇到未知异常."
951        }
952    }
953
954    Error_01423 = {
955        "Topic": "测试任务被异常中止[01423]",
956        "Code": "01423",
957        "Message": {
958            "en": "Failed to start the xdevice agent service "
959                  "because an error is reported when parsing the args "
960                  "parameter.",
961            "ch": "启动xdevice agent服务失败:解析args参数报错."
962        }
963    }
964
965    Error_01424 = {
966        "Topic": "测试任务被异常中止[01424]",
967        "Code": "01424",
968        "Message": {
969            "en": "Failed to reclaim the xdevice agent service process.",
970            "ch": "回收xdevice agent服务进程失败."
971        }
972    }
973
974    Error_01425 = {
975        "Topic": "测试任务被异常中止[01425]",
976        "Code": "01425",
977        "Message": {
978            "en": "Socket message authentication failed:Decrypt failed due "
979                  "to The message component, decrypted message, or key type "
980                  "is incorrect.",
981            "ch": "socket消息认证失败:消息组件、解密的消息、秘钥类型错误导致解密失败."
982        }
983    }
984
985    Error_01426 = {
986        "Topic": "测试任务被异常中止[01426]",
987        "Code": "01426",
988        "Message": {
989            "en": "Socket message authentication failed:An unknown error "
990                  "occurred during message decryption, and the socket message"
991                  " authentication failed.",
992            "ch": "socket消息认证失败:消息解密遇到未知错误."
993        }
994    }
995
996    Error_01427 = {
997        "Topic": "测试任务被异常中止[01427]",
998        "Code": "01427",
999        "Message": {
1000            "en": "devicetest upload generate test report failed.",
1001            "ch": "devicetest上报任务汇总报告失败."
1002        }
1003    }
1004
1005    Error_01428 = {
1006        "Topic": "测试任务被异常中止[01428]",
1007        "Code": "01428",
1008        "Message": {
1009            "en": "devicetest upload generate test report failed.",
1010            "ch": "devicetest上报任务汇总报告失败."
1011        }
1012    }
1013
1014    Error_01429 = {
1015        "Topic": "测试任务被异常中止[01429]",
1016        "Code": "01429",
1017        "Message": {
1018            "en": "Failed to obtain the list of failed cases during task "
1019                  "rerun. An unknown error is reported.",
1020            "ch": "任务重跑获取失败用例列表异常:出现未知报错."
1021        }
1022    }
1023
1024    Error_01430 = {
1025        "Topic": "测试任务被异常中止[01430]",
1026        "Code": "01430",
1027        "Message": {
1028            "en": "The type of the test case list transferred by the xdevice "
1029                  "is incorrect.",
1030            "ch": "xdevice传递重试用例列表类型错误,不是列表."
1031        }
1032    }
1033
1034    Error_01431 = {
1035        "Topic": "测试任务被异常中止[01431]",
1036        "Code": "01431",
1037        "Message": {
1038            "en": "Dry-run failed: The {} json configuration file of the "
1039                  "scrpit does not exist. Please check.",
1040            "ch": "dry-run失败:脚本xxx.json配置文件不存在,请检查!"
1041        }
1042    }
1043
1044    Error_01432 = {
1045        "Topic": "测试任务被异常中止[01432]",
1046        "Code": "01432",
1047        "Message": {
1048            "en": "Failed to obtain the test case during task re-execution. "
1049                  "An error is reported when the data returned by the "
1050                  "xdevice is parsed.",
1051            "ch": "任务重跑获取失败用例异常:解析xdevice返回的数据报错."
1052        }
1053    }
1054
1055    Error_01433 = {
1056        "Topic": "测试任务被异常中止[01433]",
1057        "Code": "01433",
1058        "Message": {
1059            "en": "report path is None, Please check",
1060            "ch": "获取任务报告失败,请检查!"
1061        }
1062    }
1063
1064    Error_01434 = {
1065        "Topic": "测试任务被异常中止[01434]",
1066        "Code": "01434",
1067        "Message": {
1068            "en": "Failed to instantiate the test runner.",
1069            "ch": "实例化测试运行程序失败."
1070        }
1071    }
1072
1073    Error_01435 = {
1074        "Topic": "测试任务被异常中止[01435]",
1075        "Code": "01435",
1076        "Message": {
1077            "en": "Set locales failed.",
1078            "ch": "设置本地化失败."
1079        }
1080    }
1081
1082    Error_01436 = {
1083        "Topic": "测试任务被异常中止[01436]",
1084        "Code": "01436",
1085        "Message": {
1086            "en": "The DECC does not deliver the log encryption key.",
1087            "ch": "DECC未下发日志加密秘钥."
1088        }
1089    }
1090
1091    Error_01437 = {
1092        "Topic": "测试任务被异常中止[01437]",
1093        "Code": "01437",
1094        "Message": {
1095            "en": "Failed to obtain the spt value of the configuration file, {}.",
1096            "ch": "获取配置文件的spt值失败."
1097        }
1098    }
1099
1100    Error_01438 = {
1101        "Topic": "测试任务被异常中止[01438]",
1102        "Code": "01438",
1103        "Message": {
1104            "en": "Loop continues fail.",
1105            "ch": "循环测试中连续失败."
1106        }
1107    }
1108
1109    ##########################################################################
1110    # RPC错误码
1111    Error_01439 = {
1112        "Topic": "测试用例执行失败[01439]",
1113        "Code": "01439",
1114        "Message": {
1115            "en": "The RPC service fails to be started.",
1116            "ch": "RPC服务启动失败。"
1117        }
1118    }
1119
1120    Error_01440 = {
1121        "Topic": "测试用例执行失败[01440]",
1122        "Code": "01440",
1123        "Message": {
1124            "en": "The RPC process is not found.",
1125            "ch": "RPC进程未查询到。"
1126        }
1127    }
1128
1129    Error_01441 = {
1130        "Topic": "测试用例执行失败[01441]",
1131        "Code": "01441",
1132        "Message": {
1133            "en": "Device's developer mode is false.",
1134            "ch": "当前设备开发者模式为关闭状态。"
1135        }
1136    }
1137
1138    Error_01442 = {
1139        "Topic": "测试用例执行失败[01442]",
1140        "Code": "01442",
1141        "Message": {
1142            "en": "HDC fport tcp port fail.",
1143            "ch": "HDC端口转发失败。"
1144        }
1145    }
1146
1147    Error_01446 = {
1148        "Topic": "测试用例执行失败[01446]",
1149        "Code": "01446",
1150        "Message": {
1151            "en": "BIN(ABC) RPC process is not found.",
1152            "ch": "BIN(ABC) RPC进程未查询到。"
1153        }
1154    }
1155
1156    Error_01447 = {
1157        "Topic": "测试用例执行失败[01447]",
1158        "Code": "01447",
1159        "Message": {
1160            "en": "BIN(ABC) RPC listening port number is not found.",
1161            "ch": "BIN(ABC) RPC监听端口号未查询到。"
1162        }
1163    }
1164
1165    # 脚本自定义的异常信息:上报用例结果的fail_msg用脚本自定义的异常信息
1166    Error_01500 = {
1167        "Topic": "{}[01500]",
1168        "Code": "01500",
1169        "Message": {
1170            "en": "",
1171            "ch": "脚本自定义的错误信息."
1172        }
1173    }
1174
1175
1176class ErrorMessage(DetailErrorMassage):
1177    """
1178    # 打印异常类信息
1179    1开头:工具报错
1180    2开头:测试套
1181    3开头:环境
1182    001:未知错误
1183    """
1184
1185    class Dict(dict):
1186        __setattr__ = dict.__setitem__
1187        __getattr__ = dict.__getitem__
1188
1189    @classmethod
1190    def add_attribute(cls):
1191        for _attribute in dir(DetailErrorMassage):
1192            if _attribute.startswith("Error_"):
1193                get_value = getattr(DetailErrorMassage, _attribute)
1194                if isinstance(get_value, dict):
1195                    value = cls.dict_to_object(get_value)
1196                    setattr(cls, _attribute, value)
1197
1198    @classmethod
1199    def dict_to_object(cls, dict_obj):
1200        if not isinstance(dict_obj, dict):
1201            return dict_obj
1202        inst = cls.Dict()
1203        for _key, _value in dict_obj.items():
1204            inst[_key] = cls.dict_to_object(_value)
1205        return inst
1206
1207
1208# 添加类属性
1209ErrorMessage.add_attribute()
1210
1211if __name__ == '__main__':
1212    print(ErrorMessage.Error_01300)
1213    print(ErrorMessage.Error_01424)
1214    print(ErrorMessage.Error_01424.Code)
1215    print(ErrorMessage.Error_01424.Message.ch)
1216